public void Setup() { ProjectStatusOnServer server = new ProjectStatusOnServer(new ProjectStatus("myProject", IntegrationStatus.Success, DateTime.Now), new DefaultServerSpecifier("myServer")); ProjectStatusListAndExceptions statusList = new ProjectStatusListAndExceptions( new ProjectStatusOnServer[] { server }, new CruiseServerException[] { }); farmServiceMock = new DynamicMock(typeof(IFarmService)); farmServiceMock.SetupResult("GetProjectStatusListAndCaptureExceptions", statusList, typeof(IServerSpecifier), typeof(string)); viewGeneratorMock = new DynamicMock(typeof(IVelocityViewGenerator)); linkFactoryMock = new DynamicMock(typeof(ILinkFactory)); ServerLocation serverConfig = new ServerLocation(); serverConfig.ServerName = "myServer"; configuration.Servers = new ServerLocation[] { serverConfig }; var urlBuilderMock = new DynamicMock(typeof(ICruiseUrlBuilder)); urlBuilderMock.SetupResult("BuildProjectUrl", string.Empty, typeof(string), typeof(IProjectSpecifier)); plugin = new ProjectReportProjectPlugin((IFarmService)farmServiceMock.MockInstance, (IVelocityViewGenerator)viewGeneratorMock.MockInstance, (ILinkFactory)linkFactoryMock.MockInstance, configuration, (ICruiseUrlBuilder)urlBuilderMock.MockInstance); cruiseRequestMock = new DynamicMock(typeof(ICruiseRequest)); cruiseRequest = (ICruiseRequest )cruiseRequestMock.MockInstance; }
public void Setup() { ProjectStatusOnServer server = new ProjectStatusOnServer(new ProjectStatus("myProject", IntegrationStatus.Success, DateTime.Now), new DefaultServerSpecifier("myServer")); ProjectStatusListAndExceptions statusList = new ProjectStatusListAndExceptions( new ProjectStatusOnServer[] { server }, new CruiseServerException[] { }); farmServiceMock = new Mock <IFarmService>(); farmServiceMock.Setup(service => service.GetProjectStatusListAndCaptureExceptions(It.IsAny <IServerSpecifier>(), It.IsAny <string>())).Returns(statusList); viewGeneratorMock = new Mock <IVelocityViewGenerator>(); linkFactoryMock = new Mock <ILinkFactory>(); ServerLocation serverConfig = new ServerLocation(); serverConfig.ServerName = "myServer"; configuration.Servers = new ServerLocation[] { serverConfig }; var urlBuilderMock = new Mock <ICruiseUrlBuilder>(); urlBuilderMock.Setup(builder => builder.BuildProjectUrl(It.IsAny <string>(), It.IsAny <IProjectSpecifier>())).Returns(string.Empty); plugin = new ProjectReportProjectPlugin((IFarmService)farmServiceMock.Object, (IVelocityViewGenerator)viewGeneratorMock.Object, (ILinkFactory)linkFactoryMock.Object, configuration, (ICruiseUrlBuilder)urlBuilderMock.Object); cruiseRequestMock = new Mock <ICruiseRequest>(); cruiseRequest = (ICruiseRequest )cruiseRequestMock.Object; }