public void GetProjectStatusSendsRequest()
 {
     ProjectStatus status = new ProjectStatus("Test project", IntegrationStatus.Success, DateTime.Now);
     ProjectStatusResponse response = new ProjectStatusResponse();
     response.Result = ResponseResult.Success;
     response.Projects.Add(status);
     CruiseServerClient client = new CruiseServerClient(
         new ServerStub("GetProjectStatus", typeof(ServerRequest), response));
     client.GetProjectStatus();
 }
        public void GetProjectStatusThrowsExceptionOnFailure()
        {
            ProjectStatusResponse response = new ProjectStatusResponse();
            IServerConnection connection = mocks.DynamicMock<IServerConnection>();
            SetupResult.For(connection.SendMessage("GetProjectStatus", null))
                .IgnoreArguments()
                .Return(response);
            mocks.ReplayAll();

            CruiseServerClient client = new CruiseServerClient(connection);
            Assert.That(delegate { client.GetProjectStatus(); },
                        Throws.TypeOf<CommunicationsException>());
        }
        public void GetProjectStatusReturnsProjects()
        {
            ProjectStatus status = new ProjectStatus("Test project", IntegrationStatus.Success, DateTime.Now);
            ProjectStatusResponse response = new ProjectStatusResponse();
            response.Result = ResponseResult.Success;
            response.Projects.Add(status);
            IServerConnection connection = mocks.DynamicMock<IServerConnection>();
            SetupResult.For(connection.SendMessage("GetProjectStatus", null))
                .IgnoreArguments()
                .Return(response);
            mocks.ReplayAll();

            CruiseServerClient client = new CruiseServerClient(connection);
            ProjectStatus[] results = client.GetProjectStatus();
            Assert.AreEqual(1, results.Length);
            Assert.AreEqual(status, results[0]);
        }