Exemple #1
0
        public void SnapshotCanBeSetAndRetrieved()
        {
            var request  = new StatusSnapshotResponse();
            var snapshot = new ProjectStatusSnapshot();

            request.Snapshot = snapshot;
            Assert.AreSame(snapshot, request.Snapshot);
        }
Exemple #2
0
        public void RequestConstructorInitialisesTheValues()
        {
            var request  = new EncryptedRequest();
            var response = new StatusSnapshotResponse(request);

            // Only check one property is set, since the properties are set by the base class
            Assert.AreEqual(request.Identifier, response.RequestIdentifier);
        }
Exemple #3
0
        public void FullConstructorInitialisesTheValues()
        {
            var response1 = new StatusSnapshotResponse();

            response1.RequestIdentifier = "12345";
            var response2 = new StatusSnapshotResponse(response1);

            // Only check one property is set, since the properties are set by the base class
            Assert.AreEqual(response1.RequestIdentifier, response2.RequestIdentifier);
        }
Exemple #4
0
        public void TakeStatusSnapshot()
        {
            var response = new StatusSnapshotResponse();

            response.Result   = ResponseResult.Success;
            response.Snapshot = new ProjectStatusSnapshot();
            var client = new CruiseServerClient(
                new ServerStub("TakeStatusSnapshot", typeof(ProjectRequest), "Project #1", response));
            var result = client.TakeStatusSnapshot("Project #1");

            Assert.AreSame(response.Snapshot, result);
        }
Exemple #5
0
        public void GetFinalBuildStatus()
        {
            var response = new StatusSnapshotResponse();

            response.Result   = ResponseResult.Success;
            response.Snapshot = new ProjectStatusSnapshot();
            var client = new CruiseServerClient(
                new ServerStub("GetFinalBuildStatus", typeof(BuildRequest), "Project #1", response));
            var result = client.GetFinalBuildStatus("Project #1", "Build #1");

            Assert.AreSame(response.Snapshot, result);
        }
        public void GetFinalBuildStatusPassesOnCall()
        {
            var mocks       = new MockRepository(MockBehavior.Default);
            var innerServer = mocks.Create <ICruiseServer>().Object;
            var request     = new BuildRequest();
            var response    = new StatusSnapshotResponse();

            Mock.Get(innerServer).Setup(_innerServer => _innerServer.GetFinalBuildStatus(request))
            .Returns(response).Verifiable();

            var configFile = this.CreateTemporaryConfigurationFile();

            using (var server = new RemoteCruiseServer(innerServer, configFile, true))
            {
                var actual = server.GetFinalBuildStatus(request);
                Assert.AreSame(response, actual);
            }

            mocks.VerifyAll();
        }
Exemple #7
0
        public void GetFinalBuildStatusPassesOnCall()
        {
            var mocks       = new MockRepository();
            var innerServer = mocks.DynamicMock <ICruiseServer>();
            var request     = new BuildRequest();
            var response    = new StatusSnapshotResponse();

            Expect.Call(innerServer.GetFinalBuildStatus(request))
            .Return(response);
            mocks.ReplayAll();

            var configFile = this.CreateTemporaryConfigurationFile();

            using (var server = new RemoteCruiseServer(innerServer, configFile, true))
            {
                var actual = server.GetFinalBuildStatus(request);
                Assert.AreSame(response, actual);
            }

            mocks.VerifyAll();
        }