public async Task Get_WithoutParamenter_ReturnsOk() { // Arrange var randomController = new RandomController(fakeHistoryService, fakeConfiguration); // Act var result = await randomController.Get(0); // Assert var okResult = Assert.IsType <OkObjectResult>(result.Result); var randomNumber = Assert.IsType <int>(okResult.Value); Assert.True(randomNumber >= 0); }
public void Test_Get_Success() { var provider = new SimpleRandomQuoteProvider(); var controller = new QuoteController(provider); var actual = controller.Get(1); Assert.IsTrue(actual.Value.ID == 1); var actual2 = controller.Get(2); Assert.IsTrue(actual2.Value.Text == "It is better to know how to learn than to know"); var actual3 = controller.Get(); Assert.IsTrue(actual3.Value.Count() == provider.quoteList.Length); var controller2 = new RandomController(provider); var actual4 = controller2.Get(); Assert.IsTrue(actual4.Value.ID <= provider.quoteList.Length); }