public void Setup() { configurationMock = new DynamicMock(typeof (IRemoteServicesConfiguration)); cruiseManagerFactoryMock = new DynamicMock(typeof(ICruiseServerClientFactory)); cruiseManagerMock = new DynamicMock(typeof (ICruiseServerClient)); serverSpecifier = new DefaultServerSpecifier("myserver"); projectSpecifier = new DefaultProjectSpecifier(serverSpecifier, "myproject"); buildSpecifier = new DefaultBuildSpecifier(projectSpecifier, "mybuild"); buildSpecifierForUnknownServer = new DefaultBuildSpecifier(new DefaultProjectSpecifier(new DefaultServerSpecifier("unknownServer"), "myProject"), "myBuild"); managerWrapper = new ServerAggregatingCruiseManagerWrapper( (IRemoteServicesConfiguration) configurationMock.MockInstance, (ICruiseServerClientFactory)cruiseManagerFactoryMock.MockInstance ); serverLocation = new ServerLocation(); serverLocation.Name = "myserver"; serverLocation.Url = "http://myurl"; serverLocation.AllowForceBuild = true; otherServerLocation = new ServerLocation(); otherServerLocation.Name = "myotherserver"; otherServerLocation.Url = "http://myotherurl"; }
private ServerAggregatingCruiseManagerWrapper InitialiseServerWrapper(MockRepository mocks, Action<CruiseServerClientBase> additionalSetup) { IRemoteServicesConfiguration configuration = mocks.DynamicMock<IRemoteServicesConfiguration>(); ICruiseServerClientFactory cruiseManagerFactory = mocks.DynamicMock<ICruiseServerClientFactory>(); CruiseServerClientBase cruiseManager = mocks.DynamicMock<CruiseServerClientBase>(); ServerLocation[] servers = new ServerLocation[] { serverLocation, otherServerLocation }; SetupResult.For(configuration.Servers) .Return(servers); SetupResult.For(cruiseManagerFactory.GenerateClient("http://myurl", new ClientStartUpSettings())) .IgnoreArguments() .Return(cruiseManager); ServerAggregatingCruiseManagerWrapper serverWrapper = new ServerAggregatingCruiseManagerWrapper( configuration, cruiseManagerFactory); if (additionalSetup != null) additionalSetup(cruiseManager); return serverWrapper; }