예제 #1
0
        public void SyncToSettings_ForEachProjectIdentifier_GetsProjectCollectionFromCache()
        {
            var projectSettingses = new[]
            {
                new MonitoredProjectSettings {
                    VstsAccount = "1st server a/c", Id = Guid.NewGuid()
                },
                new MonitoredProjectSettings {
                    VstsAccount = "2nd server a/c", Id = Guid.NewGuid()
                },
                new MonitoredProjectSettings {
                    VstsAccount = "3rd server a/c", Id = Guid.NewGuid()
                },
            };

            _monitorSettings.Projects.Returns(projectSettingses);
            var tfsServer = Substitute.For <ITfProjectCollection>();

            tfsServer.GetProject(Arg.Any <Guid>()).Returns(Substitute.For <ITfProject>());
            _tfProjectCollectionCache.GetProjectCollection(Arg.Any <string>()).Returns(tfsServer);
            var systemUnderTest = new Monitor(_monitorSettings, _tfProjectCollectionCache, _nameRegexpRepositoryFilterFactory, _logger);

            systemUnderTest.SyncMonitoredProjects(projectSettingses);

            foreach (var projectIdentifier in projectSettingses)
            {
                _tfProjectCollectionCache.Received().GetProjectCollection(projectIdentifier.VstsAccount);
            }
        }