public void NoChangeNoEvent() { var change = Diff.CollectionChange(new[] { 1, 2, 3 }, new[] { 1, 2, 3 }); var notifier = new DummyNotifier(); var actual = notifier.SubscribeAll(); Notifier.Notify(notifier, change, null, notifier.PropertyChangedEventHandler, notifier.NotifyCollectionChangedEventHandler); CollectionAssert.IsEmpty(actual); }
public void BindToPropertyChange_Propagated() { bool wasCalled = false; var not = new DummyNotifier(); var cmd = new DelegateCommand((p) => { }, (p) => p != null); cmd.BindCanExecuteToProperty(not, "Number"); cmd.CanExecuteChanged += (s, e) => wasCalled = true; not.Number = 123; Assert.IsTrue(wasCalled); }
public void Remove(int index) { var before = new[] { 1, 2, 3 }; var ints = new ObservableCollection <int>(before); var expected = ints.SubscribeAll(); var notifier = new DummyNotifier(); var actual = notifier.SubscribeAll(); ints.RemoveAt(index); var change = Diff.CollectionChange(before, ints); Notifier.Notify(notifier, change, null, notifier.PropertyChangedEventHandler, notifier.NotifyCollectionChangedEventHandler); CollectionAssert.AreEqual(expected, actual, EventArgsComparer.Default); }
public void AddToEmpty() { var ints = new ObservableCollection <int>(); var expected = ints.SubscribeAll(); ints.Add(1); var notifier = new DummyNotifier(); var actual = notifier.SubscribeAll(); var change = Diff.CollectionChange(new int[0], ints); Notifier.Notify(notifier, change, null, notifier.PropertyChangedEventHandler, notifier.NotifyCollectionChangedEventHandler); CollectionAssert.AreEqual(expected, actual, EventArgsComparer.Default); }
public async Task Can_configure_outbox_notifier() { var services = new ServiceCollection(); var dummyOutboxNotifier = new DummyNotifier(); services.AddOutbox(options => { options.WithNotifier(dummyOutboxNotifier); options.Register <DummyMessage>("foo", "bar", x => "baz"); options.WithOutboxEntryRepository(serviceProvider => new FakeOutboxPersistence()); }); var provider = services.BuildServiceProvider(); var outbox = provider.GetRequiredService <OutboxQueue>(); var outboxNotifier = await outbox.Enqueue(new[] { new DummyMessage() }); Assert.Same(dummyOutboxNotifier, outboxNotifier); }
void Update_WithThreeSoccerEvents_ReturnsTrue() { // Arrange ISoccerEventsProvider provider = new StubThreeSoccerEventsProvider(); ISoccerEventsStore store = new DummySoccerEventsStore(); INotifier notifier = new DummyNotifier(); string infoEmailAddress = "*****@*****.**", infoMessage = "Soccer events processed successfully", alertEmailAddress = "*****@*****.**", alertSmsNumber = "6999999999", alertMessage = "ALERT! No soccer events!"; SoccerEventsTask sut = new SoccerEventsTask(provider, store, notifier, infoEmailAddress, infoMessage, alertEmailAddress, alertSmsNumber, alertMessage); bool expected = true; // Act bool actual = sut.Update(); // Assert Assert.Equal(expected, actual); }