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); }
public void PollAggregateRequiresNotNullRepository() { // arrange IPollRepository repo = GetRepositoryMock().Object; //act var aggregate = new PollAggregate(repo); // assert Assert.NotNull(aggregate); Assert.Throws <ArgumentNullException>(() => new PollAggregate(null)); }