Edward M
0
Q:

how to test mediatr

  mockPeopleService = new Mock<IPeopleService>();
  var people = ....;

            var expectedResult = new GetCatsResponse()
            {
                Male = new List<string>() { "Garfield", "Jim", "Max", "Tom" },
                Female = new List<string>() { "Garfield", "Simba", "Tabby" }
            };

            mockPeopleService.Setup(ps => ps.GetPeople()).Returns(people);

            var handler = new GetCatsHandler(mockPeopleService.Object);

            var actualResult = await GetActualResult(handler);

            actualResult.Should().BeEquivalentTo(expectedResult, optons => optons.WithStrictOrdering());
0

New to Communities?

Join the community