public void BugService_When_FindBugIsCalledWithAEmptySpaceId_Then_ApplicationExceptionIsThrown() { var id = " "; var service = new BugService(_repository.Object); Assert.ThrowsAsync <ApplicationException>(() => service.FindBug(id)); }
public async void BugService_When_FindBugIsCalledWithAValidIdButNoBugFound_Then_NullIsReturned() { var id = "123"; Bug bug = null; _repository.Setup(_ => _.Find(id)).ReturnsAsync(bug); var service = new BugService(_repository.Object); var result = await service.FindBug(id); Assert.Null(result); }
public async void BugService_When_FindBugIsCalledWithAValidId_Then_ABugIsReturned() { var id = "123"; var bug = new Bug { Id = "123", Title = "Bug Title", Description = "Bug Description" }; _repository.Setup(_ => _.Find(id)).ReturnsAsync(bug); var service = new BugService(_repository.Object); var result = await service.FindBug(id); Assert.Same(bug, result); }