public void ThrowsCorrectExceptionIfServerNotKnown()
        {
            configurationMock.SetupGet(_configuration => _configuration.Servers).Returns(new ServerLocation[] { serverLocation }).Verifiable();
            try
            {
                managerWrapper.GetLog(buildSpecifierForUnknownServer, null);
                Assert.Fail("Should throw exception");
            }
            catch (UnknownServerException e)
            {
                Assert.AreEqual("unknownServer", e.RequestedServer);
            }

            configurationMock.SetupGet(_configuration => _configuration.Servers).Returns(new ServerLocation[] { serverLocation }).Verifiable();
            try
            {
                managerWrapper.GetLatestBuildSpecifier(buildSpecifierForUnknownServer.ProjectSpecifier, null);
                Assert.Fail("Should throw exception");
            }
            catch (UnknownServerException e)
            {
                Assert.AreEqual("unknownServer", e.RequestedServer);
            }

            VerifyAll();
        }
        public void ReturnsLatestLogNameFromCorrectProjectOnCorrectServer()
        {
            string         buildName = "mylogformyserverformyproject";
            MockRepository mocks     = new MockRepository(MockBehavior.Default);
            ServerAggregatingCruiseManagerWrapper serverWrapper = InitialiseServerWrapper(mocks,
                                                                                          delegate(CruiseServerClientBase manager)
            {
                Mock.Get(manager).Setup(_manager => _manager.GetLatestBuildName(It.IsAny <string>()))
                .Returns(buildName);
            });

            DefaultProjectSpecifier myProjectMyServer = new DefaultProjectSpecifier(new DefaultServerSpecifier("myserver"), "myproject");

            Assert.AreEqual(new DefaultBuildSpecifier(myProjectMyServer, buildName),
                            serverWrapper.GetLatestBuildSpecifier(myProjectMyServer, null));
        }
Ejemplo n.º 3
0
        public void ReturnsLatestLogNameFromCorrectProjectOnCorrectServer()
        {
            string         buildName = "mylogformyserverformyproject";
            MockRepository mocks     = new MockRepository();
            ServerAggregatingCruiseManagerWrapper serverWrapper = InitialiseServerWrapper(mocks,
                                                                                          delegate(CruiseServerClientBase manager)
            {
                SetupResult.For(manager.GetLatestBuildName(null))
                .IgnoreArguments()
                .Return(buildName);
            });

            mocks.ReplayAll();

            DefaultProjectSpecifier myProjectMyServer = new DefaultProjectSpecifier(new DefaultServerSpecifier("myserver"), "myproject");

            Assert.AreEqual(new DefaultBuildSpecifier(myProjectMyServer, buildName),
                            serverWrapper.GetLatestBuildSpecifier(myProjectMyServer, null));
        }