Exemplo n.º 1
0
        public async void Get()
        {
            var mock   = new ServiceMockFacade <ICountryRepository>();
            var record = new Country();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new CountryService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CountryModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLCountryMapperMock,
                                             mock.DALMapperMockFactory.DALCountryMapperMock,
                                             mock.BOLMapperMockFactory.BOLProvinceMapperMock,
                                             mock.DALMapperMockFactory.DALProvinceMapperMock);

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

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Exemplo n.º 2
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ICountryRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Country>(null));
            var service = new CountryService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.CountryModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLCountryMapperMock,
                                             mock.DALMapperMockFactory.DALCountryMapperMock,
                                             mock.BOLMapperMockFactory.BOLCountryRequirementMapperMock,
                                             mock.DALMapperMockFactory.DALCountryRequirementMapperMock,
                                             mock.BOLMapperMockFactory.BOLDestinationMapperMock,
                                             mock.DALMapperMockFactory.DALDestinationMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Exemplo n.º 3
0
        public async void TestGet()
        {
            ApiCountryResponseModel response = await this.Client.CountryGetAsync(1);

            response.Should().NotBeNull();
        }