コード例 #1
0
        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();
        }
コード例 #2
0
        public async Task DeleteCounter_PublishesAMessage()
        {
            // Act
            await service.DeleteCounter(new Counter());

            // Assert
            mockMessenger.Verify(m => m.Publish(It.IsAny <CountersChangedMessage>()));
        }
コード例 #3
0
        [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
        }
コード例 #4
0
 }                                              //A public property that exposes the command
 async Task DeleteCounter()
 {
     await service.DeleteCounter(counter); //The command deletes the counter from the service
 }
コード例 #5
0
 async Task DeleteCounter()
 {
     await service.DeleteCounter(counter);
 }