public async Task Get_WhenCalled_With_An_DeckId_Should_Return_OkResult() { // Arrange const int deckId = 43242; _mediator.Send(Arg.Any <IRequest <DeckDetailOutputModel> >()).Returns(new DeckDetailOutputModel()); // Act var result = await _sut.Get(deckId); // Assert result.Should().BeOfType <OkObjectResult>(); }
public async Task Get_Method_Returns_Ok() { //Arrange var mockRepository = new Mock <IFlashcardDataRepository>(); mockRepository.Setup(x => x.GetAllDecks()).Returns(Task.FromResult(GetFakeDecks())); DecksController decksController = new DecksController(mockRepository.Object, iMapper); //Act var result = await decksController.Get(); //Assert var okObjectResult = Assert.IsType <OkObjectResult>(result); var returnDecks = Assert.IsType <DeckResponse>(okObjectResult.Value); Assert.Equal(2, returnDecks.Decks.Count); }