public async Task GetUsersSampleByIDAsync_ShouldReturnNotFound_WhenUserSampleIsNull() { //arrange int id = -2; UsersSample usersSample = null; _projectBLMock.Setup(i => i.GetUsersSampleByIDAsync(id)).ReturnsAsync(usersSample); UsersSampleController usersSampleController = new UsersSampleController(_projectBLMock.Object); //act var result = await usersSampleController.GetUsersSampleByIDAsync(id); //assert Assert.IsType <NotFoundResult>(result); }
public async Task GetUsersSampleByIDAsync_ShouldReturnOKObject_WhenIDIsValid() { //arrange int id = 1; UsersSample usersSample = new UsersSample(); _projectBLMock.Setup(i => i.GetUsersSampleByIDAsync(id)).ReturnsAsync(usersSample); UsersSampleController usersSampleController = new UsersSampleController(_projectBLMock.Object); //act var result = await usersSampleController.GetUsersSampleByIDAsync(id); //assert Assert.IsType <OkObjectResult>(result); }