Exemplo n.º 1
0
        public void Initialise_Loads_Project_Cache_With_All_Projects_Types_For_Empty_Id_List()
        {
            var mocks = new MockRepository();

            IBuildClient client = SetupMockedClient(mocks);

            using (mocks.Playback())
            {
                var monitor = new TeamCityBuildMonitor(client);

                monitor.Initialise();

                IEnumerable<BuildProjectModel> projects = monitor.GetAllBuildProjects();

                projects.Should().NotBeEmpty().And.HaveCount(2);

                BuildProjectModel one = projects.First();

                one.Id.Should().Be("1");
                one.Name.Should().Be("A");
                one.BuildTypes.Should().NotBeEmpty().And.HaveCount(2);

                BuildProjectModel two = projects.Last();

                two.Id.Should().Be("2");
                two.Name.Should().Be("B");
                two.BuildTypes.Should().NotBeEmpty().And.HaveCount(2);
            }
        }
Exemplo n.º 2
0
        public void Initialise_Loads_Only_One_Build_Type_From_Each_Project()
        {
            var mocks = new MockRepository();

            IBuildClient client = SetupMockedClient(mocks);

            using (mocks.Playback())
            {
                var monitor = new TeamCityBuildMonitor(client, "3", "6");

                monitor.Initialise();

                IEnumerable<BuildProjectModel> projects = monitor.GetAllBuildProjects();

                projects.Should().NotBeEmpty().And.HaveCount(2);

                BuildProjectModel one = projects.First();

                one.Id.Should().Be("1");
                one.BuildTypes.Should().NotBeEmpty().And.HaveCount(1);

                BuildProjectModel two = projects.Last();

                two.Id.Should().Be("2");
                two.BuildTypes.Should().NotBeEmpty().And.HaveCount(1);
            }
        }
        public void BuildMonitor_Establishes_BuildHistory()
        {
            var teamcityClient = GetTeamcityClient();
            var monitor = new TeamCityBuildMonitor(teamcityClient);

            monitor.MonitorEvents();

            monitor.Initialise();

            monitor.ShouldRaise("BuildUpdated").WithSender(monitor);
        }
        public void BuildMonitor_Can_Setup_Projects()
        {
            TeamCityClient teamcityClient = GetTeamcityClient();
            var monitor = new TeamCityBuildMonitor(teamcityClient);

            monitor.Initialise();

            IEnumerable<BuildProjectModel> projects = monitor.GetAllBuildProjects();

            projects.Should().NotBeEmpty().And.HaveCount(c => c > 0);
        }
Exemplo n.º 5
0
        public void Initialise_Does_Not_Cache_Project_With_Unspecified_Build_Types()
        {
            var mocks = new MockRepository();

            IBuildClient client = SetupMockedClient(mocks);

            using (mocks.Playback())
            {
                var monitor = new TeamCityBuildMonitor(client, "5", "6");

                monitor.Initialise();

                IEnumerable<BuildProjectModel> projects = monitor.GetAllBuildProjects();

                projects.Should().NotBeEmpty().And.HaveCount(1);

                BuildProjectModel one = projects.First();

                one.Id.Should().Be("2");
                one.BuildTypes.Should().NotBeEmpty().And.HaveCount(2);
            }
        }
Exemplo n.º 6
0
        protected override IPollingMonitor CreateMonitor(Dictionary<string, string> configuration)
        {
            var username = configuration["Username"];
            var password = configuration["Password"];
            var uri = configuration["Uri"];
            var buildTypeIds = new string[0];

            if (configuration.ContainsKey("BuildTypeIds"))
            {
                buildTypeIds = configuration["BuildTypeIds"].Split(',');
            }

            var client = new TeamCityClient(uri, username, password);

            var monitor = new TeamCityBuildMonitor(client, buildTypeIds);

            _eventSource = Observable.FromEventPattern<BuildEventArgs>(monitor, "BuildUpdated").Select(e=>e.EventArgs.Build);

            _eventHandler = _eventSource.ObserveOnDispatcher().Subscribe(ReceiveBuild);

            return monitor;
        }