Пример #1
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IVStateProvinceCountryRegionRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <VStateProvinceCountryRegion>(null));
            var service = new VStateProvinceCountryRegionService(mock.LoggerMock.Object,
                                                                 mock.RepositoryMock.Object,
                                                                 mock.ModelValidatorMockFactory.VStateProvinceCountryRegionModelValidatorMock.Object,
                                                                 mock.BOLMapperMockFactory.BOLVStateProvinceCountryRegionMapperMock,
                                                                 mock.DALMapperMockFactory.DALVStateProvinceCountryRegionMapperMock);

            ApiVStateProvinceCountryRegionResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Пример #2
0
        public async void All()
        {
            var mock    = new ServiceMockFacade <IVStateProvinceCountryRegionRepository>();
            var records = new List <VStateProvinceCountryRegion>();

            records.Add(new VStateProvinceCountryRegion());
            mock.RepositoryMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult(records));
            var service = new VStateProvinceCountryRegionService(mock.LoggerMock.Object,
                                                                 mock.RepositoryMock.Object,
                                                                 mock.ModelValidatorMockFactory.VStateProvinceCountryRegionModelValidatorMock.Object,
                                                                 mock.BOLMapperMockFactory.BOLVStateProvinceCountryRegionMapperMock,
                                                                 mock.DALMapperMockFactory.DALVStateProvinceCountryRegionMapperMock);

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

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