Пример #1
0
        public async Task RemoveBuildConfig_WhenOtherConnectionIdsAreUsingIt_ShouldNotRemoveTheBuild()
        {
            var duplicateBuild = _fixture.Create<Models.BuildConfig>();

            var connectionId = _fixture.Create<string>();
            var builds = _fixture
                .Build<Models.BuildConfig>()
                .CreateMany()
                .ToList();
            builds.Add(duplicateBuild);

            var otherConnectionId = _fixture.Create<string>();
            var otherBuilds = _fixture
                .Build<Models.BuildConfig>()
                .CreateMany()
                .ToList();
            otherBuilds.Add(duplicateBuild);

            var connManager = new ConnectionsManager();
            await connManager.AddBuildConfigs(connectionId, builds);
            await connManager.AddBuildConfigs(otherConnectionId, otherBuilds);

            var removeBuild = builds.First();
            await connManager.RemoveBuildConfig(connectionId, removeBuild);

            connManager.BuildsPerConnId.Keys.Count.Should().Be(2);
            connManager.BuildsToBeRefreshed.Should().NotContainKey(removeBuild.CiExternalId);
        }
Пример #2
0
        public async Task RemoveBuildConfig_ShouldRemoveTheBuild()
        {
            var connectionId = _fixture.Create<string>();
            var builds = _fixture
                .Build<Models.BuildConfig>()
                .CreateMany()
                .ToList();

            var connManager = new ConnectionsManager();
            await connManager.AddBuildConfigs(connectionId, builds);

            connManager.BuildsPerConnId.Keys.Should()
                .Contain(connectionId);

            await connManager.RemoveBuildConfig(connectionId, builds.First());

            connManager.BuildsPerConnId.Keys.Should().Contain(connectionId);
            connManager.BuildsPerConnId[connectionId].Count.Should()
                .Be(builds.Count() - 1);

            connManager.BuildsToBeRefreshed.Keys.Count.Should()
                .Be(builds.Count() - 1);
        }