/// <summary> /// Initializes a new instance of the <see cref="ReadExternalCommerceSystemProductDivisionsTest"/> class. /// </summary> public ReadExternalCommerceSystemProductDivisionsTest() { this.client = Substitute.For <IProductsServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IProductsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.processor = new ReadExternalCommerceSystemProductDivisions { ClientFactory = clientFactory }; this.request = new SynchronizeProductDivisionsRequest("100500"); this.args = new ServicePipelineArgs(this.request, new ServiceProviderResult()); }
/// <summary> /// Initializes a new instance of the <see cref="GetExternalCommerceSystemProductListTest" /> class. /// </summary> public GetExternalCommerceSystemProductListTest() { this.client = Substitute.For <IProductsServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IProductsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.processor = new NopCommerce.Pipelines.Products.GetExternalCommerceSystemProductList.GetExternalCommerceSystemProductList { ClientFactory = clientFactory }; this.request = new GetExternalCommerceSystemProductListRequest(); this.args = new ServicePipelineArgs(this.request, new ServiceProviderResult()); }
/// <summary> /// Initializes a new instance of the <see cref="ReadExternalCommerceSystemDivisionsTest" /> class. /// </summary> public ReadExternalCommerceSystemDivisionsTest() { this.entityFactory = Substitute.For <IEntityFactory>(); this.entityFactory.Create("Division").Returns(callInfo => new Division()); this.client = Substitute.For <IProductsServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IProductsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.processor = new ReadExternalCommerceSystemDivisions { EntityFactory = this.entityFactory, ClientFactory = clientFactory }; this.args = new ServicePipelineArgs(new SynchronizeDivisionsRequest(), new ServiceProviderResult()); }
/// <summary> /// Initializes a new instance of the <see cref="ReadExternalCommerceSystemProductMainImageTest" /> class. /// </summary> public ReadExternalCommerceSystemProductMainImageTest() { this.entityFactory = Substitute.For <IEntityFactory>(); this.entityFactory.Create("ProductResource").Returns(callInfo => new ProductResource()); this.client = Substitute.For <IProductsServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IProductsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.processor = new ReadExternalCommerceSystemProductMainImage { EntityFactory = this.entityFactory, ClientFactory = clientFactory }; this.request = new SynchronizeProductResourcesRequest("100500"); this.args = new ServicePipelineArgs(this.request, new ServiceProviderResult()); }
/// <summary> /// Initializes a new instance of the <see cref="ReadExternalCommerceSystemManufacturersTest" /> class. /// </summary> public ReadExternalCommerceSystemManufacturersTest() { this.entityFactory = Substitute.For <IEntityFactory>(); this.entityFactory.Create("Manufacturer").Returns(callInfo => new Manufacturer()); this.client = Substitute.For <IProductsServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IProductsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.processor = new ReadExternalCommerceSystemManufacturers { EntityFactory = entityFactory, ClientFactory = clientFactory }; this.request = new SynchronizeManufacturersRequest(); this.result = new ServiceProviderResult(); this.args = new ServicePipelineArgs(this.request, this.result); }
/// <summary> /// Initializes a new instance of the <see cref="ReadExternalCommerceSystemClassificationsTest" /> class. /// </summary> public ReadExternalCommerceSystemClassificationsTest() { this.entityFactory = Substitute.For <IEntityFactory>(); this.entityFactory.Create("Classification").Returns(callInfo => new Classification()); this.entityFactory.Create("ClassificationGroup").Returns(callInfo => new ClassificationGroup()); this.client = Substitute.For <IProductsServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IProductsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.processor = new ReadExternalCommerceSystemClassifications("categories", "100500") { EntityFactory = this.entityFactory, ClientFactory = clientFactory }; this.request = new SynchronizeClassificationsRequest(); this.args = new ServicePipelineArgs(this.request, new ServiceProviderResult()); }
/// <summary> /// Initializes a new instance of the <see cref="SaveProductToExternalCommerceSystemTest" /> class. /// </summary> public SaveProductToExternalCommerceSystemTest() { this.client = Substitute.For <IProductsServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IProductsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.processor = new SaveProductToExternalCommerceSystem { ClientFactory = clientFactory }; this.product = new Product { ExternalId = "100500", Name = "Cool car", ShortDescription = "Yea, dude. You wants this one", FullDescription = "Don't think, just pay for this" }; this.language = "en"; this.request = new SynchronizeProductRequest("100500") { Language = this.language }; this.result = new ServiceProviderResult(); this.args = new ServicePipelineArgs(this.request, this.result); this.args.Request.Properties["Product"] = this.product; }
/// <summary> /// Gets the resource. /// </summary> /// <param name="nopServiceClient">The service client.</param> /// <param name="externalProductId">The external product id.</param> /// <returns> /// Product resource model. /// </returns> protected override ProductResourceModel GetResource(IProductsServiceChannel nopServiceClient, string externalProductId) { return(nopServiceClient.GetProductDownloads(externalProductId)); }
/// <summary> /// Gets the related ids. /// </summary> /// <param name="client">The client.</param> /// <param name="externalProductId">The external product id.</param> /// <returns>Related ids.</returns> protected override string[] GetRelatedIds(IProductsServiceChannel client, string externalProductId) { return(client.GetVariantProductsIds(externalProductId)); }
/// <summary> /// Initializes a new instance of the <see cref="ReadExternalCommerceSystemProductTest" /> class. /// </summary> // TODO:[Minor] Test initialization is too complex and it is not required for all the tests in the class. This lead to unclear test behaviour. public ReadExternalCommerceSystemProductTest() { this.entityFactory = Substitute.For <IEntityFactory>(); this.entityFactory.Create("Product").Returns(callInfo => new Product()); this.entityFactory.Create("ClassificationGroup").Returns(callInfo => new ClassificationGroup()); this.entityFactory.Create("Classification").Returns(callInfo => new Classification()); this.entityFactory.Create("Specification").Returns(callInfo => new Specification()); this.entityFactory.Create("ProductType").Returns(callInfo => new ProductType()); this.client = Substitute.For <IProductsServiceChannel>(); var clientFactory = Substitute.For <ServiceClientFactory>(); clientFactory.CreateClient <IProductsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client); this.productClassificationGroupName = "Categories"; this.productClassificationGroupExternalId = "0"; this.processor = new ReadExternalCommerceSystemProduct(this.productClassificationGroupName, this.productClassificationGroupExternalId) { EntityFactory = this.entityFactory, ClientFactory = clientFactory }; this.product = new Product { ExternalId = "100500" }; this.language = "en"; this.request = new SynchronizeProductRequest("100500") { Language = this.language }; this.result = new ServiceProviderResult(); this.args = new ServicePipelineArgs(this.request, this.result); this.created = DateTime.Now; this.updated = DateTime.Now; this.productModel = new ProductModel { ProductId = "100500", ProductVariantId = "100500", Name = "Cool car", ShortDescription = "Yea, dude. You wants this one", FullDescription = "Don't think, just pay for this", ManufacturerIds = new[] { "The best company in the world" }, CreatedOnUtc = this.created, UpdatedOnUtc = this.updated, CategoryIds = new[] { "Cars", "Luxury" }, Sku = "sku", ProductGlobalSpecifications = new[] { new ProductGlobalSpecificationModel { SpecificationLookupId = "157", LookupValueId = "157_300", SpecificationLookupName = "hard drive", LookupValueName = "xxx" }, new ProductGlobalSpecificationModel { SpecificationLookupId = "200", LookupValueId = "200_400", SpecificationLookupName = "memory", LookupValueName = "yyy" } } }; }