Пример #1
0
        public async void SearchPlanet_Ok()
        {
            //Arrange
            var planet = new Planet
            {
                Id   = Guid.NewGuid(),
                Name = "A-1"
            };

            m_repositoryMock.Setup(t => t.SearchAsync(It.IsAny <Pagination>(), It.IsAny <Ordering>(), It.IsAny <IFilter <Planet> >()))
            .ReturnsAsync(new Tuple <int, List <Planet> >(1, new List <Planet> {
                planet
            }));

            //Act
            var(count, planets) = await m_planetService.SearchPlanetAsync(new Pagination(), new Ordering(), new PlanetFilter
            {
                SearchTerm = planet.Id.ToString()
            });

            //Assert
            m_repositoryMock.Verify(t => t.SearchAsync(It.IsAny <Pagination>(), It.IsAny <Ordering>(), It.IsAny <PlanetFilter>()), Times.Once);
            Assert.Equal(1, count);
            Assert.Equal(planet, planets.First());
        }