public async Task UpdateAsync_ThreeMessagesWillBeSent_ValidCall() { await StudentHomeworkUpdater.UpdateAsync(_homework, StudentHomeworkUpdater.UpdateType.AddHomework); StudentRepoMock.Verify(m => m.GetAsync(It.IsAny <int>())); StudentRepoMock.Verify(m => m.Update(It.IsAny <Student>())); MessageServiceAccessorMock.Verify(m => m.Invoke(It.IsAny <string>()) .Send(It.IsAny <Student>(), new NullLoggerFactory().CreateLogger("")), Times.Exactly(3)); }
public async Task UpdateAsync_NoMessagesWillBeSent_ValidCall() { StudentRepoMock.Setup(repo => repo.GetAsync(It.IsAny <int>())) .Returns(GetStudentWithoutSendingMessages()); await StudentHomeworkUpdater.UpdateAsync(_homework, StudentHomeworkUpdater.UpdateType.AddHomework); StudentRepoMock.Verify(m => m.GetAsync(It.IsAny <int>())); StudentRepoMock.Verify(m => m.Update(It.IsAny <Student>())); MessageServiceAccessorMock.Verify(m => m.Invoke(It.IsAny <string>()) .Send(It.IsAny <Student>(), new NullLoggerFactory().CreateLogger("")), Times.Exactly(0)); }