예제 #1
0
        public void ThreeRepositoriesAddedAndAggregated()
        {
            var underTest = new RepositoryStatusAggregator();

            underTest.Add(Mock.Of <INotifyRepositoryPropertyChanged>(r => r.NumberOfChanges == 1 && r.Status == SyncStatus.Idle && r.LastFinishedSync == (DateTime?)null));
            underTest.Add(Mock.Of <INotifyRepositoryPropertyChanged>(r => r.NumberOfChanges == 2 && r.Status == SyncStatus.Disconnected && r.LastFinishedSync == DateTime.Now));
            underTest.Add(Mock.Of <INotifyRepositoryPropertyChanged>(r => r.NumberOfChanges == 0 && r.Status == SyncStatus.Warning && r.LastFinishedSync == DateTime.Now));

            Assert.That(underTest.NumberOfChanges, Is.EqualTo(3));
            Assert.That(underTest.LastFinishedSync, Is.Null);
            Assert.That(underTest.Status, Is.EqualTo(SyncStatus.Warning));
        }
예제 #2
0
        public void RemoveRepository()
        {
            var underTest = new RepositoryStatusAggregator();

            var repo = Mock.Of <INotifyRepositoryPropertyChanged>(r => r.NumberOfChanges == 2 && r.Status == SyncStatus.Idle && r.LastFinishedSync == DateTime.Now);

            underTest.Add(repo);
            underTest.Remove(repo);

            Assert.That(underTest.NumberOfChanges, Is.EqualTo(0));
            Assert.That(underTest.LastFinishedSync, Is.EqualTo(null));
            Assert.That(underTest.Status, Is.EqualTo(SyncStatus.Disconnected));
        }
예제 #3
0
        public void AddRepository()
        {
            var underTest       = new RepositoryStatusAggregator();
            var numberOfChanges = 2;
            var status          = SyncStatus.Idle;
            var lastSync        = DateTime.Now;

            underTest.Add(Mock.Of <INotifyRepositoryPropertyChanged>(r => r.NumberOfChanges == numberOfChanges && r.Status == status && r.LastFinishedSync == lastSync));

            Assert.That(underTest.NumberOfChanges, Is.EqualTo(numberOfChanges));
            Assert.That(underTest.LastFinishedSync, Is.EqualTo(lastSync));
            Assert.That(underTest.Status, Is.EqualTo(status));
        }