public async Task HandleAsync_ReturnsOkWithCorrectQuantityOfEmailTypes() { var emailTypes = new EmailType[] { new EmailType { Name = "byuser", Placeholders = new Dictionary <string, string>() { { "UserName", "{USERNAME}" }, } }, new EmailType { Name = "common", Placeholders = new Dictionary <string, string>() } }; _emailFactoryTypeRepositoryMock.Setup(repository => repository.GetAllNames()) .Returns(emailTypes.Select(t => t.Name)); _emailFactoryTypeRepositoryMock.Setup(repository => repository.GetPlaceholders(It.IsAny <string>())) .Returns((string typeName) => { return(emailTypes.First(t => t.Name == typeName).Placeholders); }); var response = await _getAll.HandleAsync(); var result = response.Result as OkObjectResult; var value = result.Value as EmailTypesResponse; Assert.Equal(emailTypes.Length, value.EmailTypes.Length); }