Beispiel #1
0
        public async void All_ShouldReturnRecords()
        {
            var mock    = new ServiceMockFacade <ICountryService, ICountryRepository>();
            var records = new List <Country>();

            records.Add(new Country());
            mock.RepositoryMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())).Returns(Task.FromResult(records));
            var service = new CountryService(mock.LoggerMock.Object,
                                             mock.MediatorMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CountryModelValidatorMock.Object,
                                             mock.DALMapperMockFactory.DALCountryMapperMock,
                                             mock.DALMapperMockFactory.DALProvinceMapperMock);

            List <ApiCountryServerResponseModel> response = await service.All();

            response.Should().HaveCount(1);
            mock.RepositoryMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>()));
        }