public async Task GetAllByAuthorWithCancellationDoesNotAcceptNull() { //arrange var repoMock = GetRepositoryMock(); var sut = new PollAggregate(repoMock.Object); //act & assert await Assert.ThrowsAsync <ArgumentNullException>(() => sut.GetAllByAuthorAsync(null, new CancellationTokenSource().Token)); }
public async Task GetAllByAuthorWithCancellationInvokesRepo() { //arrange var repoMock = GetRepositoryMock(); var sut = new PollAggregate(repoMock.Object); //act await sut.GetAllByAuthorAsync(new SchedUser(Guid.NewGuid(), ""), new CancellationTokenSource().Token); //assert repoMock.Verify(repo => repo.GetAllByAuthorAsync(It.IsAny <SchedUser>(), It.IsAny <CancellationToken>()), Times.Once); }