public async Task GetPersonsAsync_Should_return_OkObjectResult_when_records_found() { //Setup _getPersonComponent.Setup(x => x.GetAllPersonsAsync()).Returns(Task.FromResult(Dummies.GetPeronList(DummieInstance.ValidInstance))); //Act var result = await personController.GetPersonsAsync(); var expectedType = new OkObjectResult(result).GetType(); var actualType = result.GetType(); //Assert Assert.True(expectedType.Equals(actualType)); //Check if the execute was called at least once on the controller method _getPersonComponent.Verify(x => x.GetAllPersonsAsync(), Times.Once); }
public async void GetAllPersonsAsync_should_return_a_List_of_Persons() { // Setup Guid personId = Guid.NewGuid(); _getPersonComponent.Setup(x => x.GetAllPersonsAsync()).Returns(Task.FromResult(Dummies.GetPeronList(DummieInstance.ValidInstance))); // Act var result = await _getPersonComponent.Object.GetAllPersonsAsync(); var expectedType = typeof(List <Library.Entities.Person>); // TODO: Should be a Task return var actualType = result.GetType(); //Assert Assert.True(expectedType.Equals(actualType)); }