public void SetUp() { _container = new AutoMocker(); var cacheProvider = _container.GetMock <ICacheProvider>(); cacheProvider .Setup(provider => provider.GetOrAddAsync( It.IsNotNull <CacheKey>(), It.IsNotNull <Func <Task <Overture.ServiceModel.Country> > >(), It.IsAny <Func <Overture.ServiceModel.Country, Task> >(), It.IsAny <CacheKey>())) .Returns <CacheKey, Func <Task <Overture.ServiceModel.Country> >, Func <Overture.ServiceModel.Country, Task>, CacheKey>( (key, func, arg3, arg4) => func()) .Verifiable(); var overtureClient = _container.GetMock <IOvertureClient>(); var dummyCountry = new Overture.ServiceModel.Country(); overtureClient .Setup(client => client.SendAsync( It.IsNotNull <GetCountryRequest>())) .ReturnsAsync(dummyCountry) .Verifiable(); _repository = _container.CreateInstance <ProductLookupRepository>(); }
internal static Mock <IOvertureClient> Create() { var dummyCountry = new Overture.ServiceModel.Country(); var overtureClient = new Mock <IOvertureClient>(MockBehavior.Strict); overtureClient.Setup(client => client.SendAsync(It.IsNotNull <GetCountryRequest>())) .ReturnsAsync(dummyCountry) .Verifiable(); var dummyRegions = new List <Region>(); overtureClient.Setup(client => client.SendAsync(It.IsNotNull <GetRegionsRequest>())) .ReturnsAsync(dummyRegions) .Verifiable(); return(overtureClient); }
internal static Mock <IOvertureClient> CreateWithNullValues() { var dummyCountry = new Overture.ServiceModel.Country { IsoCode = null, Id = null, Name = null, PropertyBag = null, IsSupported = false, PhoneRegex = null, PostalCodeRegex = null, Regions = null, SortOrder = -1 }; var overtureClient = new Mock <IOvertureClient>(MockBehavior.Strict); overtureClient.Setup(client => client.SendAsync(It.IsNotNull <GetCountryRequest>())) .ReturnsAsync(dummyCountry) .Verifiable(); return(overtureClient); }
internal static Mock <ICountryRepository> Create() { var country = new Overture.ServiceModel.Country(); var countryRepository = new Mock <ICountryRepository>(MockBehavior.Strict); countryRepository.Setup(repo => repo.RetrieveCountry(It.IsNotNull <RetrieveCountryParam>())) .ReturnsAsync(country) .Verifiable(); var regions = new List <Region> { new Region() }; countryRepository.Setup(repo => repo.RetrieveRegions(It.IsNotNull <RetrieveCountryParam>())) .ReturnsAsync(regions) .Verifiable(); return(countryRepository); }
internal static Mock <ICountryRepository> CreateWithNullValues() { var country = new Overture.ServiceModel.Country { IsoCode = null, Name = null, PropertyBag = null, Id = null, IsSupported = false, PhoneRegex = null, PostalCodeRegex = null, Regions = null, SortOrder = -1 }; var countryRepository = new Mock <ICountryRepository>(MockBehavior.Strict); countryRepository.Setup(repo => repo.RetrieveCountry(It.IsNotNull <RetrieveCountryParam>())) .ReturnsAsync(country) .Verifiable(); return(countryRepository); }