예제 #1
0
        public shared()
        {
            this.firstDate = new DateTime(2000, 10, 10);
            this.secondDate = new DateTime(2000, 10, 11);
            this.failedBuild1 = new Build() { FinishedTime = firstDate, Status = DomainModel.CI.BuildStatus.FinishedWithFailure };
            this.failedBuild2 = new Build() { FinishedTime = firstDate, Status = DomainModel.CI.BuildStatus.FinishedWithFailure };
            this.failedBuild3 = new Build() { FinishedTime = secondDate, Status = DomainModel.CI.BuildStatus.FinishedWithFailure };
            this.successBuild1 = new Build() { FinishedTime = firstDate, Status = DomainModel.CI.BuildStatus.FinishedSuccefully };
            this.successBuild2 = new Build() { FinishedTime = secondDate, Status = DomainModel.CI.BuildStatus.FinishedSuccefully };

            this.project1 = new CIProject("test one");
            project1.AddBuild(failedBuild1);
            project1.AddBuild(successBuild1);

            this.project2 = new CIProject("test two");
            project2.AddBuild(failedBuild2);
            project2.AddBuild(failedBuild3);
            project2.AddBuild(successBuild2);

            this.ciserver = new CIServer("server", "serverurl");
            ciserver.AddProject(project1);
            ciserver.AddProject(project2);

            repository.Setup(r => r.Get(It.IsAny<AllSpecification<CIServer>>()))
                .Returns(new List<CIServer>() { ciserver });
        }
예제 #2
0
 public void Use_xml_configuration_to_persist_objects()
 {
     var server = new CIServer("cc.net", "http://smeedee.net");
     server.AddProject(new CIProject("development")
     {
         SystemId = "haldis"
     });
     server.AddProject(new CIProject("main")
     {
         SystemId = "Haldis2"
     });
     session.Save(server);
     session.Flush();
 }
예제 #3
0
파일: CITests.cs 프로젝트: ArildF/Smeedee
        public void assure_object_graph_is_Serialized_correctly()
        {
            DataContractSerializer serializer = new DataContractSerializer(typeof(IEnumerable<CIServer>), null, int.MaxValue,false, true, null);
            

            CIServer server = new CIServer() {Name = "Test name", Url = "http://www.smeedee.org"};
            CIProject project = new CIProject(){Server = server, ProjectName = "SmeeDee"};
            Build build = new Build() { SystemId = "123"};
            server.AddProject(project);
            project.AddBuild(build);

            List<CIServer> listOfServers = new List<CIServer>();
            listOfServers.Add(server);

            MemoryStream stream = new MemoryStream();

            serializer.WriteObject(stream, listOfServers);
            stream.Position = 0;

            object deSerialized = serializer.ReadObject(stream);

            var deSerializedServerList = deSerialized as IEnumerable<CIServer>;

            var deSerializedServer = deSerializedServerList.ElementAt(0);
            deSerializedServer.Name.ShouldBe("Test name");
            deSerializedServer.Url.ShouldBe("http://www.smeedee.org");

            deSerializedServer.Projects.Count() .ShouldBe(1);
            deSerializedServer.Projects.ElementAt(0).ProjectName.ShouldBe("SmeeDee");
            deSerializedServer.Projects.ElementAt(0).Server.Name.ShouldBe("Test name");
            deSerializedServer.Projects.ElementAt(0).Server.Url.ShouldBe("http://www.smeedee.org");

            deSerializedServer.Projects.ElementAt(0).Builds.Count().ShouldBe(1);
            deSerializedServer.Projects.ElementAt(0).Builds.ElementAt(0).SystemId.ShouldBe("123");
            deSerializedServer.Projects.ElementAt(0).Builds.ElementAt(0).Project.ProjectName.ShouldBe("SmeeDee");
            deSerializedServer.Projects.ElementAt(0).Builds.ElementAt(0).Project.Server.Name.ShouldBe("Test name");
        }
예제 #4
0
 public ServerConfigViewModel(CIServer server, Configuration config)
 {
     Server = server;
     Projects = (from project in server.Projects select new ProjectConfigViewModel(project, config)).ToList();
 }
예제 #5
0
 private static void AssertCIServer(CIServer expected, CIServer actual)
 {
     actual.ShouldNotBeNull();
     actual.Url.ShouldBe(expected.Url);
     actual.Projects.ShouldNotBeNull();
     actual.Projects.Count().ShouldBe(expected.Projects.Count());
 }
        private void SetupObjectGraph()
        {
            this.server = new CIServer()
            {
                Name = "CruiseControl.NET",
                Url = "http://agileprojectdashboard.org/ccnet"
            };

            this.project = new CIProject(TESTPROJECTNAME_ONE)
            {
                SystemId = "ProjectNr.1",
            };

            var project2 = new CIProject(TESTPROJECTNAME_TWO)
            {
                SystemId = "ProjectNr.2",
            };

            server.AddProject(project);
            server.AddProject(project2);


            var build1 = new Build
            {
                SystemId = "Build.1",
                StartTime = new DateTime(2000, 1, 1),
                FinishedTime = new DateTime(2000, 1, 2),
                Status = BuildStatus.FinishedSuccefully,
                Trigger = new CodeModifiedTrigger("tuxbear")
            };

            var build2 = new Build
            {
                SystemId = "Build.2",
                StartTime = new DateTime(2000, 1, 3),
                FinishedTime = new DateTime(2000, 1, 4),
                Status = BuildStatus.FinishedWithFailure,
                Trigger = new CodeModifiedTrigger("tuxbear")
            };

            var build3 = new Build
            {
                SystemId = "Build.3",
                StartTime = new DateTime(2000, 1, 5),
                FinishedTime = new DateTime(2000, 1, 6),
                Status = BuildStatus.Unknown,
                Trigger = new CodeModifiedTrigger("tuxbear")
            };

            var build4 = new Build
            {
                SystemId = "Build.4",
                StartTime = new DateTime(2000, 1, 7),
                FinishedTime = new DateTime(2000, 1, 8),
                Status = BuildStatus.Building,
                Trigger = new CodeModifiedTrigger("tuxbear")
            };

            project.AddBuild(build1);
            project.AddBuild(build2);
            project.AddBuild(new Build
            {
                SystemId = "Build.Common",
                StartTime = DateTime.MinValue,
                FinishedTime = DateTime.MaxValue,
                Status = BuildStatus.FinishedSuccefully,
                Trigger = new CodeModifiedTrigger("tuxbear")
            });

            project2.AddBuild(build3);
            project2.AddBuild(build4);
            project2.AddBuild(new Build
            {
                SystemId = "Build.Common",
                StartTime = DateTime.MinValue,
                FinishedTime = DateTime.MaxValue,
                Status = BuildStatus.FinishedSuccefully,
                Trigger = new CodeModifiedTrigger("tuxbear")
            });

        }
        public void Setup()
        {
            DeleteDatabaseIfExists();
            RecreateSessionFactory();

            var sessionFactory = NHibernateFactory.AssembleSessionFactory(DATABASE_TEST_FILE);
            var persister = new CIServerDatabaseRepository(sessionFactory);

            var server = new CIServer("goeran", "http://goeran.no");
            server.AddProject(new CIProject("goeran - development")
            {
                SystemId = "1"
            });

            var server2 = new CIServer("jonas", "http://jonas.no");
            server2.AddProject(new CIProject("jonas - development")
            {
                SystemId = "2"
            });

            persister.Save(server);
            persister.Save(server2);

            session = sessionFactory.OpenSession();
        }