public void SplitTest2() { var request = new SplitRequest() { OrderId = "5ef94dd0b936477c8a0dd63aa68154e", ProList = new List <Product>() { new Product() { ProNo = "9344949000174", SkuNo = "9344949000174", Quantity = 1, ProName = "Maxigenes 美可卓脱脂奶粉 蓝妹子 1kg", ProPrice = 14.5M, Weight = 1400 }, new Product() { ProNo = "9344949000136", SkuNo = "9344949000136", Quantity = 2, ProName = "Maxigenes 美可卓全脂奶粉 蓝胖子 1kg", ProPrice = 13.5M, Weight = 1400 } }, Type = 1 }; var result = this._splitService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Single(result.Item2.OrderList); Assert.Equal("AU Express", result.Item2.OrderList[0].LogisticsName); Assert.Equal("澳邮成人奶粉专线", result.Item2.OrderList[0].SubBusinessName); }
public void SplitTest_2() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "735282490033", Quantity = 10, ProName = "MUNCHKIN碗", ProPrice = 1, Weight = 100 } }, TotalQuantity = 1, Type = 3 }; var result = this._splitAppService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Single(result.Item2.OrderList); Assert.Equal("CNP Express", result.Item2.OrderList[0].LogisticsName); Assert.Equal("中邮杂货专线", result.Item2.OrderList[0].SubBusinessName); }
public static void Run() { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new DocumentApi(configuration); try { var fileInfo = new FileInfo { FilePath = "WordProcessing/sample-10-pages.docx" }; var options = new SplitOptions { FileInfo = fileInfo, OutputPath = "Output/split-to-multipage-document", Pages = new List <int?> { 3, 6, 8 }, Mode = SplitOptions.ModeEnum.Intervals }; var request = new SplitRequest(options); var response = apiInstance.Split(request); foreach (var document in response.Documents) { Console.WriteLine("Output file path: " + document.Path); } } catch (Exception e) { Console.WriteLine("Exception while calling api: " + e.Message); } }
public void SplitTest3() { var request = new SplitRequest() { OrderId = "5ef94dd0b936477c8a0dd63aa68154e", ProList = new List <Product>() { new Product() { ProNo = "3039011141406", SkuNo = "3039011141406", Quantity = 2, ProName = "【预售】OZLANA 2018 3039 春夏鞋", ProPrice = 72.5M, Weight = 1450 } }, Type = 1 }; var result = this._splitService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Equal(2, result.Item2.OrderList.Count); Assert.Equal("CNP Express", result.Item2.OrderList[0].LogisticsName); Assert.Equal("中邮杂货专线", result.Item2.OrderList[0].SubBusinessName); Assert.Equal("CNP Express", result.Item2.OrderList[1].LogisticsName); Assert.Equal("中邮杂货专线", result.Item2.OrderList[1].SubBusinessName); }
public static void Run() { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new DocumentApi(configuration); try { var fileInfo = new FileInfo { FilePath = "WordProcessing/sample-10-pages.docx" }; var options = new SplitOptions { FileInfo = fileInfo, OutputPath = "Output/split-by-start-end-numbers", StartPageNumber = 3, EndPageNumber = 7, Mode = SplitOptions.ModeEnum.Pages }; var request = new SplitRequest(options); var response = apiInstance.Split(request); foreach (var document in response.Documents) { Console.WriteLine("Output file path: " + document.Path); } } catch (Exception e) { Console.WriteLine("Exception while calling api: " + e.Message); } }
public void SplitTest1() { var request = new SplitRequest() { OrderId = "5ef94dd0b936477c8a0dd63aa68154e", ProList = new List <Product>() { new Product() { ProNo = "9418783003414", SkuNo = "9418783003414", Quantity = 6, ProName = "Aptamil爱他美白金版婴儿奶粉2段(6-12个月)900g", ProPrice = 28.5M, Weight = 1200 } }, Type = 1 }; var result = this._splitService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Equal(2, result.Item2.OrderList.Count); Assert.Equal("AU Express", result.Item2.OrderList[0].LogisticsName); Assert.Equal("澳邮婴儿奶粉专线", result.Item2.OrderList[0].SubBusinessName); Assert.Equal("AU Express", result.Item2.OrderList[1].LogisticsName); Assert.Equal("澳邮婴儿奶粉专线", result.Item2.OrderList[1].SubBusinessName); }
public async Task SplitTest_2() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "735282490033", Quantity = 10, ProName = "MUNCHKIN碗", ProPrice = 1, Weight = 100, PTId = "9029900" } }, TotalQuantity = 1, Type = 3 }; var result = await this._splitService.Split(request, this._context.GetTenantId()); Assert.Single(result.OrderList); Assert.Equal("CNP Express", result.OrderList[0].LogisticsName); Assert.Equal("CNP Express", result.OrderList[0].LogisticsCode); Assert.Equal("中邮杂货专线", result.OrderList[0].SubBusinessName); }
public async Task <SplitedOrder> Split(SplitRequest request, int?tenantId) { await this.ValidRequire(request, tenantId); var spliter = await this.GetSpliter(tenantId); return(spliter.Split(request.OrderId, request.ProList, request.TotalQuantity, request.Type)); }
public Tuple <string, SplitedOrder> Split(SplitRequest request) { var validResult = this.ValidRequire(request); if (!validResult.Item1) { return(Tuple.Create <string, SplitedOrder>(validResult.Item2, null)); } return(Tuple.Create(string.Empty, this.spliter.Split(request.OrderId, request.ProList, request.TotalQuantity, request.Type))); }
public async Task <ActionResult <SplitResult> > Post(SplitRequest request) { SplitResult result = await _splitter.SplitAsync(request.InputFilePath, request.OutputFilePath, request.PageList); if (result.ErrorStatus != null) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; } return(result); }
public void SplitTest8() { var request = new SplitRequest() { OrderId = "5ef94dd0b936477c8a0dd63aa68154e", ProList = new List <Product>() { new Product() { ProNo = "9314839006814", SkuNo = "9314839006814", Quantity = 10, ProName = "Ego QV儿童3合1 洗护洁面洗发沐浴液350g", ProPrice = 10.76M, Weight = 430 }, new Product() { ProNo = "9314839011931", SkuNo = "9314839011931", Quantity = 10, ProName = "Ego QV婴儿洗发沐浴2合1 无泪配方250g", ProPrice = 6.05M, Weight = 280 } }, Type = 1 }; var result = this._splitService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Equal(7, result.Item2.OrderList.Count); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[0].LogisticsName); Assert.Equal("EWE杂货经济线", result.Item2.OrderList[0].SubBusinessName); Assert.Single(result.Item2.OrderList[0].ProList); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[1].LogisticsName); Assert.Equal("EWE杂货经济线", result.Item2.OrderList[1].SubBusinessName); Assert.Single(result.Item2.OrderList[1].ProList); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[2].LogisticsName); Assert.Equal("EWE杂货经济线", result.Item2.OrderList[2].SubBusinessName); Assert.Single(result.Item2.OrderList[2].ProList); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[3].LogisticsName); Assert.Equal("EWE杂货经济线", result.Item2.OrderList[3].SubBusinessName); Assert.Equal(2, result.Item2.OrderList[3].ProList.Count); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[4].LogisticsName); Assert.Equal("EWE杂货经济线", result.Item2.OrderList[4].SubBusinessName); Assert.Single(result.Item2.OrderList[4].ProList); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[5].LogisticsName); Assert.Equal("EWE杂货经济线", result.Item2.OrderList[5].SubBusinessName); Assert.Single(result.Item2.OrderList[5].ProList); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[6].LogisticsName); Assert.Equal("EWE杂货经济线", result.Item2.OrderList[6].SubBusinessName); Assert.Single(result.Item2.OrderList[6].ProList); }
public async Task SplitInputValid_Test() { UserFriendlyException result = null; var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "26098951", Quantity = 1, ProName = "MAMIA婴幼儿奶粉二段900G二段", ProPrice = 100, Weight = 100, PTId = "1010703" }, new Product() { ProNo = "", SkuNo = "26113807", Quantity = 2, ProName = "MAMIA婴幼儿奶粉三段900G三段", ProPrice = 100, Weight = 100, PTId = "1010704" } }, TotalQuantity = 1, Type = 3 }; //商品重量不能为0 request.ProList.ForEach(o => o.Weight = 0); result = await Assert.ThrowsAsync <UserFriendlyException>(() => this._splitService.Split(request, this._context.GetTenantId())); Assert.Equal((int)ResultCode.BadRequest_ParamConstraint, result.Code); Assert.Equal("product's weight must more then zero", result.Message); //商品价格不能为0 request.ProList.ForEach(o => { o.ProPrice = 0; o.Weight = 100; }); result = await Assert.ThrowsAsync <UserFriendlyException>(() => this._splitService.Split(request, this._context.GetTenantId())); Assert.Equal((int)ResultCode.BadRequest_ParamConstraint, result.Code); Assert.Equal("product's price must more then zero", result.Message); //商品数量不能为0 request.ProList.ForEach(o => { o.Quantity = 0; o.ProPrice = 100; }); result = await Assert.ThrowsAsync <UserFriendlyException>(() => this._splitService.Split(request, this._context.GetTenantId())); Assert.Equal((int)ResultCode.BadRequest_ParamConstraint, result.Code); Assert.Equal("product's quantity must more then zero", result.Message); }
public void SplitTest2() { var request = new SplitRequest() { OrderId = "5ef94dd0b936477c8a0dd63aa68154e", ProList = new List <Product>() { new Product() { ProNo = "708177112662", SkuNo = "708177112662", Quantity = 3, ProName = "Jurlique 恬蜜玫瑰沐浴露 300ml", ProPrice = 24.5M, Weight = 400 }, new Product() { ProNo = "708177054375", SkuNo = "708177054375", Quantity = 2, ProName = "Jurlique 檀香木护发素 300ml", ProPrice = 19.6M, Weight = 500 }, new Product() { ProNo = "708177054290", SkuNo = "708177054290", Quantity = 3, ProName = "Jurlique 檀香木洗发水 300ml 檀香木洗发水", ProPrice = 19.6M, Weight = 500 }, new Product() { ProNo = "708177054399", SkuNo = "708177054399", Quantity = 1, ProName = "Jurlique婴儿温和洗发沐浴露200ml", ProPrice = 17.5M, Weight = 272 } }, Type = 3 }; var result = this._splitService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Single(result.Item2.OrderList); }
public async Task ReplaceSku_SplitFailure_Test() { var scInput = new SplitRequest() { OrderId = "20180629001", Type = 3, TotalQuantity = 0, ProList = new List <SplitPackage.Split.SplitModels.Product>() { new SplitPackage.Split.SplitModels.Product() { ProNo = "测试商品1", SkuNo = "20180629002", Quantity = 4, ProName = "奶牛的阵地", ProPrice = 10, Weight = 100, PTId = "1010706" }, } }; var result = await this._splitService.Split(scInput, this._context.GetTenantId()); result.OrderList.Any(o => o.ProList.Any(oi => !oi.PTId.Equals("1010706"))).ShouldBeFalse(); var sweInput = new SplitWithExpRequest1() { OrderId = "20180629001", TotalQuantity = 0, ProList = new List <SplitPackage.Split.SplitModels.Product>() { new SplitPackage.Split.SplitModels.Product() { ProNo = "测试商品1", SkuNo = "20180629002", Quantity = 4, ProName = "奶牛的阵地", ProPrice = 10, Weight = 100, PTId = "1010706" }, }, logistics = new List <string> { "EWE Express 标准线" } }; result = await this._splitService.SplitWithOrganization1(sweInput, this._context.GetTenantId()); result.OrderList.Any(o => o.ProList.Any(oi => !oi.PTId.Equals("1010706"))).ShouldBeFalse(); }
public void SplitInputValidTest() { Tuple <string, SplitedOrder> result = null; var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "26098951", Quantity = 1, ProName = "MAMIA婴幼儿奶粉二段900G二段", ProPrice = 100, Weight = 100 }, new Product() { ProNo = "", SkuNo = "26113807", Quantity = 2, ProName = "MAMIA婴幼儿奶粉三段900G三段", ProPrice = 100, Weight = 100 } }, TotalQuantity = 1, Type = 3 }; //商品重量不能为0 request.ProList.ForEach(o => o.Weight = 0); result = this._splitAppService.Split(request); Assert.Equal("商品重量必须大于0", result.Item1); //商品价格不能为0 request.ProList.ForEach(o => { o.ProPrice = 0; o.Weight = 100; }); result = this._splitAppService.Split(request); Assert.Equal("商品价格必须大于0", result.Item1); //商品数量不能为0 request.ProList.ForEach(o => { o.Quantity = 0; o.ProPrice = 100; }); result = this._splitAppService.Split(request); Assert.Equal("商品数量必须大于0", result.Item1); //该商品sku商品库不存在 request.ProList.ForEach(o => { o.SkuNo = "$$$$"; o.Quantity = 1; }); result = this._splitAppService.Split(request); Assert.Equal("不存在SkuNo:$$$$", result.Item1); }
public async Task SplitTest_1() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "391709501015", Quantity = 1, ProName = "NOZOHAEM止鼻血凝胶4粒", ProPrice = 57, Weight = 100, PTId = "9029900" }, new Product() { ProNo = "", SkuNo = "735282370007", Quantity = 1, ProName = "Munchkin草饲牧牛婴儿配方奶粉1段", ProPrice = 57, Weight = 100, PTId = "1010703" }, new Product() { ProNo = "", SkuNo = "768990017414", Quantity = 1, ProName = "孕妇DHA", ProPrice = 57, Weight = 100, PTId = "1019904" } }, TotalQuantity = 1, Type = 3 }; var result = await this._splitService.Split(request, this._context.GetTenantId()); Assert.Single(result.OrderList); Assert.Equal("ZH Express", result.OrderList[0].LogisticsName); Assert.Equal("ZH Express", result.OrderList[0].LogisticsCode); Assert.Equal("中环杂货混装线", result.OrderList[0].SubBusinessName); }
public void SplitTest_1() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "391709501015", Quantity = 1, ProName = "NOZOHAEM止鼻血凝胶4粒", ProPrice = 57, Weight = 100 }, new Product() { ProNo = "", SkuNo = "735282370007", Quantity = 1, ProName = "Munchkin草饲牧牛婴儿配方奶粉1段", ProPrice = 57, Weight = 100 }, new Product() { ProNo = "", SkuNo = "768990017414", Quantity = 1, ProName = "孕妇DHA", ProPrice = 57, Weight = 100 } }, TotalQuantity = 1, Type = 3 }; var result = this._splitAppService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Single(result.Item2.OrderList); Assert.Equal("ZH Express", result.Item2.OrderList[0].LogisticsName); Assert.Equal("中环杂货混装线", result.Item2.OrderList[0].SubBusinessName); }
public void SplitTest4() { var request = new SplitRequest() { OrderId = "5ef94dd0b936477c8a0dd63aa68154e", ProList = new List <Product>() { new Product() { ProNo = "689214788944", SkuNo = "689214788944", Quantity = 1, ProName = "Goodcombo 角鲨烯胶囊 1000毫克 365粒", ProPrice = 45M, Weight = 720 }, new Product() { ProNo = "9316199000037", SkuNo = "9316199000037", Quantity = 1, ProName = "LUCAS PAPAW神奇番木瓜膏25g", ProPrice = 4.5M, Weight = 75 }, new Product() { ProNo = "9300807238837", SkuNo = "9300807238837", Quantity = 1, ProName = "Jurlique 檀香木洗发水 300ml 檀香木洗发水", ProPrice = 8M, Weight = 80 } }, Type = 1 }; var result = this._splitService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Single(result.Item2.OrderList); }
public async Task SplitTest_3() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "852696000204", Quantity = 15, ProName = "COBRAMESTATE橄榄油750ML", ProPrice = 1, Weight = 100, PTId = "1019903" }, new Product() { ProNo = "", SkuNo = "857052004445", Quantity = 10, ProName = "SKIPHOP围兜", ProPrice = 1, Weight = 100, PTId = "9029900" } }, TotalQuantity = 25, Type = 3 }; var result = await this._splitService.Split(request, this._context.GetTenantId()); Assert.Equal(2, result.OrderList.Count); Assert.Equal("CNP Express", result.OrderList[0].LogisticsName); Assert.Equal("CNP Express", result.OrderList[0].LogisticsCode); Assert.Equal("中邮杂货专线", result.OrderList[0].SubBusinessName); Assert.Equal("CNP Express", result.OrderList[1].LogisticsName); Assert.Equal("CNP Express", result.OrderList[1].LogisticsCode); Assert.Equal("中邮杂货专线", result.OrderList[1].SubBusinessName); }
public void SplitTest9() { var request = new SplitRequest() { OrderId = "5ef94dd0b936477c8a0dd63aa68154e", ProList = new List <Product>() { new Product() { ProNo = "9421902960055", SkuNo = "9421902960055", Quantity = 6, ProName = "A2白金幼儿配方奶粉 3段(12个月以上)", ProPrice = 32M, Weight = 1200 }, new Product() { ProNo = "9421902960031", SkuNo = "9421902960031", Quantity = 3, ProName = "A2白金幼儿配方奶粉 1段(初生婴儿)", ProPrice = 37M, Weight = 1200 } }, Type = 3 }; var result = this._splitService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Equal(2, result.Item2.OrderList.Count); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[0].LogisticsName); Assert.Equal("EWE经济线6罐奶粉", result.Item2.OrderList[0].SubBusinessName); Assert.Single(result.Item2.OrderList[0].ProList); Assert.Equal("EWE Express 经济线", result.Item2.OrderList[1].LogisticsName); Assert.Equal("EWE经济线1-3罐奶粉", result.Item2.OrderList[1].SubBusinessName); Assert.Single(result.Item2.OrderList[1].ProList); }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(Constants.ParameterSetNames.ObjectParameterSet)) { string[] name = Reservation.Name.Split('/'); ReservationOrderId = new Guid(name[0]); ReservationId = new Guid(name[1]); } var resourceInfo = $"Reservation {ReservationId} in order {ReservationOrderId}"; if (ShouldProcess(resourceInfo, "Split")) { var quantityParameter = Quantity.Select(q => (int?)q).ToList(); SplitRequest Split = new SplitRequest( quantityParameter, CreateResourceId(ReservationOrderId, ReservationId) ); var response = AzureReservationAPIClient.Reservation.Split(ReservationOrderId.ToString(), Split).Select(x => new PSReservation(x)).ToList(); WriteObject(response, true); } }
public async Task <bool> SplitTest() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "26098951", Quantity = 1, ProName = "MAMIA婴幼儿奶粉二段900G二段", ProPrice = 100, Weight = 100, PTId = "1010703" }, new Product() { ProNo = "", SkuNo = "26113807", Quantity = 2, ProName = "MAMIA婴幼儿奶粉三段900G三段", ProPrice = 100, Weight = 100, PTId = "1010704" } }, TotalQuantity = 1, Type = 3 }; var result = await this._splitService.Split(request, this._context.GetTenantId()); Assert.Single(result.OrderList); Assert.Equal("4PX Express", result.OrderList[0].LogisticsName); Assert.Equal("4PX Express", result.OrderList[0].LogisticsCode); Assert.Equal("转运四方现代物流3罐婴儿奶粉专线", result.OrderList[0].SubBusinessName); return(true); }
public void SplitTest_3() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "852696000204", Quantity = 15, ProName = "COBRAMESTATE橄榄油750ML", ProPrice = 1, Weight = 100 }, new Product() { ProNo = "", SkuNo = "857052004445", Quantity = 10, ProName = "SKIPHOP围兜", ProPrice = 1, Weight = 100 } }, TotalQuantity = 25, Type = 3 }; var result = this._splitAppService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Equal(2, result.Item2.OrderList.Count); Assert.Equal("CNP Express", result.Item2.OrderList[0].LogisticsName); Assert.Equal("中邮杂货专线", result.Item2.OrderList[0].SubBusinessName); Assert.Equal("CNP Express", result.Item2.OrderList[1].LogisticsName); Assert.Equal("中邮杂货专线", result.Item2.OrderList[1].SubBusinessName); }
public async Task SplitTest_4() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "70000137", Quantity = 10, ProName = "蜡笔细长0.15", ProPrice = 1, Weight = 100, PTId = "1019903" }, new Product() { ProNo = "", SkuNo = "93262170", Quantity = 5, ProName = "BONJELA口腔凝胶15G", ProPrice = 1, Weight = 100, PTId = "1019904" } }, TotalQuantity = 15, Type = 3 }; var result = await this._splitService.Split(request, this._context.GetTenantId()); Assert.Single(result.OrderList); Assert.Equal("THEARK EXPRESS", result.OrderList[0].LogisticsName); Assert.Equal("THEARK EXPRESS", result.OrderList[0].LogisticsCode); Assert.Equal("方舟AlphaEX", result.OrderList[0].SubBusinessName); }
public void SplitTest7() { var request = new SplitRequest() { OrderId = "5ef94dd0b936477c8a0dd63aa68154e", ProList = new List <Product>() { new Product() { ProNo = "9421902960055", SkuNo = "9421902960055", Quantity = 6, ProName = "A2白金幼儿配方奶粉 3段(12个月以上)", ProPrice = 33M, Weight = 1250 } }, Type = 1 }; var result = this._splitService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Equal(2, result.Item2.OrderList.Count); }
public void SplitTest() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "26098951", Quantity = 1, ProName = "MAMIA婴幼儿奶粉二段900G二段", ProPrice = 100, Weight = 100 }, new Product() { ProNo = "", SkuNo = "26113807", Quantity = 2, ProName = "MAMIA婴幼儿奶粉三段900G三段", ProPrice = 100, Weight = 100 } }, TotalQuantity = 1, Type = 3 }; var result = this._splitAppService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Single(result.Item2.OrderList); Assert.Equal("4PX Express", result.Item2.OrderList[0].LogisticsName); Assert.Equal("转运四方现代物流3罐婴儿奶粉专线", result.Item2.OrderList[0].SubBusinessName); }
public void SplitTest_4() { var request = new SplitRequest() { OrderId = "18040300110001", ProList = new List <Product>() { new Product() { ProNo = "", SkuNo = "70000137", Quantity = 10, ProName = "蜡笔细长0.15", ProPrice = 1, Weight = 100 }, new Product() { ProNo = "", SkuNo = "93262170", Quantity = 5, ProName = "BONJELA口腔凝胶15G", ProPrice = 1, Weight = 100 } }, TotalQuantity = 15, Type = 3 }; var result = this._splitAppService.Split(request); Assert.Equal(string.Empty, result.Item1); Assert.Single(result.Item2.OrderList); Assert.Equal("THEARK EXPRESS", result.Item2.OrderList[0].LogisticsName); Assert.Equal("方舟AlphaEX", result.Item2.OrderList[0].SubBusinessName); }
private void TestSplitAndMerge(string reservationOrderId) { HttpMockServer.RecordsDirectory = GetSessionsDirectoryPath(); using (MockContext context = MockContext.Start(this.GetType().FullName)) { var reservationsClient = ReservationsTestUtilities.GetAzureReservationAPIClient(context, new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }); var reservations = reservationsClient.Reservation.List(reservationOrderId); var enumerator1 = reservations.GetEnumerator(); ReservationResponse validReservation = null; while (enumerator1.MoveNext()) { var currentReservation = enumerator1.Current; if (String.Equals(currentReservation.Properties.ProvisioningState, "Succeeded")) { validReservation = currentReservation; break; } } Assert.NotNull(validReservation); var reservationId = validReservation.Id.Split('/')[6]; // Begin split test SplitRequest Split = new SplitRequest( new List <int?>() { 1, 2 }, CreateResourceId(reservationOrderId, reservationId) ); var splitResponse = reservationsClient.Reservation.Split(reservationOrderId, Split); Assert.NotNull(splitResponse); Assert.True(splitResponse.Any()); var enumerator2 = splitResponse.GetEnumerator(); ReservationResponse splitReservation1 = null; ReservationResponse splitReservation2 = null; while (enumerator2.MoveNext()) { var currentReservation = enumerator2.Current; if (String.Equals(currentReservation.Properties.ProvisioningState, "Succeeded")) { if (splitReservation1 == null) { splitReservation1 = currentReservation; } else { splitReservation2 = currentReservation; } } } var splitReservationId1 = splitReservation1.Id.Split('/')[6]; var splitReservationId2 = splitReservation2.Id.Split('/')[6]; // Begin merge test MergeRequest Merge = new MergeRequest( new List <string>() { CreateResourceId(reservationOrderId, splitReservationId1), CreateResourceId(reservationOrderId, splitReservationId2) } ); var mergeResponse = reservationsClient.Reservation.Merge(reservationOrderId, Merge); var enumerator3 = splitResponse.GetEnumerator(); ReservationResponse mergedReservation = null; while (enumerator3.MoveNext()) { var currentReservation = enumerator3.Current; if (String.Equals(currentReservation.Properties.ProvisioningState, "Succeeded")) { mergedReservation = currentReservation; } } Assert.NotNull(mergedReservation); ValidateReservation(mergedReservation); } }
/// <summary> /// Split the `Reservation`. /// </summary> /// <remarks> /// Split a `Reservation` into two `Reservation`s with specified quantity /// distribution. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='reservationOrderId'> /// Order Id of the reservation /// </param> /// <param name='body'> /// Information needed to Split a reservation item /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <ReservationResponse> > SplitAsync(this IReservationOperations operations, string reservationOrderId, SplitRequest body, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SplitWithHttpMessagesAsync(reservationOrderId, body, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Split the `Reservation`. /// </summary> /// <remarks> /// Split a `Reservation` into two `Reservation`s with specified quantity /// distribution. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='reservationOrderId'> /// Order Id of the reservation /// </param> /// <param name='body'> /// Information needed to Split a reservation item /// </param> public static IList <ReservationResponse> Split(this IReservationOperations operations, string reservationOrderId, SplitRequest body) { return(operations.SplitAsync(reservationOrderId, body).GetAwaiter().GetResult()); }