Skip to content

Instantly share code, notes, and snippets.

@fivunlm
Created October 25, 2016 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fivunlm/4078d25331da2ee20e440e1fe612ff33 to your computer and use it in GitHub Desktop.
Save fivunlm/4078d25331da2ee20e440e1fe612ff33 to your computer and use it in GitHub Desktop.
[TestClass]
public class Test
{
private IApplication MockApp(IScreenService screenService, IMessageRouterService messageRouterService,
IXACService xacService, IDataService dataService)
{
var application = Mock.Interface<IApplication>();
Expect.Once.PropertyGet(() => application.ScreenService).Returns(screenService);
Expect.Once.PropertyGet(() => application.MsgRouterService).Returns(messageRouterService);
Expect.Once.PropertyGet(() => application.XACService).Returns(xacService);
Expect.Once.PropertyGet(() => application.DataService).Returns(dataService);
return application;
}
[TestMethod]
public void Test()
{
var msgRouterService = Mock.Interface<IMessageRouterService>();
var screenService = Mock.Interface<IScreenService>();
var dataService = Mock.Interface<IDataService>();
var xacService = Mock.Interface<IXACService>();
var app = MockApp(screenService, msgRouterService, xacService, dataService);
var controller = new SelectPumpController(app);
AssertExpectations.IsMetFor(app);
AssertExpectations.IsMetFor(screenService);
AssertExpectations.IsMetFor(msgRouterService);
AssertExpectations.IsMetFor(xacService);
AssertExpectations.IsMetFor(dataService);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment