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 ReturnsCorrectLogFromCorrectProjectOnCorrectServer()
        {
            string         buildLog = "content\r\nlogdata";
            MockRepository mocks    = new MockRepository(MockBehavior.Default);
            ServerAggregatingCruiseManagerWrapper serverWrapper = InitialiseServerWrapper(mocks,
                                                                                          delegate(CruiseServerClientBase manager)
            {
                Mock.Get(manager).Setup(_manager => _manager.GetLog(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>()))
                .Returns(buildLog);
            });

            Assert.AreEqual(buildLog, serverWrapper.GetLog(new DefaultBuildSpecifier(projectSpecifier, "test"), null));
        }
Example #3
0
        public void ReturnsCorrectLogFromCorrectProjectOnCorrectServer()
        {
            string         buildLog = "content\r\nlogdata";
            MockRepository mocks    = new MockRepository();
            ServerAggregatingCruiseManagerWrapper serverWrapper = InitialiseServerWrapper(mocks,
                                                                                          delegate(CruiseServerClientBase manager)
            {
                SetupResult.For(manager.GetLog(null, null))
                .IgnoreArguments()
                .Return(buildLog);
            });

            mocks.ReplayAll();
            Assert.AreEqual(buildLog, serverWrapper.GetLog(new DefaultBuildSpecifier(projectSpecifier, "test"), null));
        }