public async Task DeleteCounter() { var counter = new Counter { Count = 0 }; await _subject.IncrementCounter(counter); A.CallTo(() => _repo.Save(counter)).MustHaveHappenedOnceExactly(); await _subject.DeleteCounter(counter); A.CallTo(() => _repo.Delete(counter)).MustHaveHappenedOnceExactly(); }
public async Task DeleteCounter_PublishesAMessage() { // Act await service.DeleteCounter(new Counter()); // Assert mockMessenger.Verify(m => m.Publish(It.IsAny <CountersChangedMessage>())); }
[Test] //Testing that the emssage is published when a counter is deleted public async Task DeleteCounter_PubishesAMessage() { //Act await service.DeleteCounter(new Counter()); //Deletes a counter from the service //Assert messenger.Verify(m => m.Publish (It.IsAny <CountersChangedMessage> ())); //Verifies that the messenger publishes a message }
} //A public property that exposes the command async Task DeleteCounter() { await service.DeleteCounter(counter); //The command deletes the counter from the service }
async Task DeleteCounter() { await service.DeleteCounter(counter); }