public async Task ReturnNoContentWhenHasNoData() { // Arrange int expectedId = 1; var Option = new Faker <OptionModelExtended>() .RuleFor(p => p.Id, v => v.IndexVariable) .RuleFor(p => p.Text, v => v.Name.FirstName()) .RuleFor(p => p.Order, v => ++ v.IndexVariable) .RuleFor(p => p.QuestionId, v => ++ v.IndexVariable) .Generate(6); _mockService.Setup(x => x.GetById(It.IsAny <int>())) .ReturnsAsync(Option.Find(x => x.Id == expectedId)); // Act var result = await _controller.GetById(expectedId); // Assert result.Should().BeOfType <NoContentResult>(); }