public async Task UpdateSampleSetsShouldUpdateSampleSets() { var sample = new SampleSets { Id = 1 }; _projectBLMock.Setup(x => x.UpdateSampleSetsAsync(It.IsAny <SampleSets>())).Returns(Task.FromResult(sample)); var sampleController = new SampleSetsController(_projectBLMock.Object); var result = await sampleController.UpdateSampleSetsAsync(sample.Id, sample); Assert.IsAssignableFrom <NoContentResult>(result); _projectBLMock.Verify(x => x.UpdateSampleSetsAsync(sample)); }
public async Task UpdateSampleSetsAsync_ShouldReturnStatusCode500_WhenIDIsInvalid() { //arrange SampleSets sampleSets = null; int id = 1; _projectBLMock.Setup(i => i.UpdateSampleSetsAsync(sampleSets)).Throws(new Exception()); SampleSetsController sampleSetsController = new SampleSetsController(_projectBLMock.Object); //act var result = await sampleSetsController.UpdateSampleSetsAsync(id, sampleSets); //assert Assert.IsType <StatusCodeResult>(result); Assert.Equal(500, ((StatusCodeResult)result).StatusCode); }