using OrBit.MESInterface.Application.Contracts.Interfaces; using Shouldly; using System.Threading.Tasks; using Xunit; namespace OrBit.MESInterface.Application.Tests.UnitTests { public class SaveDataAppServiceTest : MESInterfaceApplicationTestBase { private readonly IDownloadDataAppService _downloadDataAppService; public SaveDataAppServiceTest() { _downloadDataAppService = GetRequiredService(); } [Fact] public async Task Should_SaveData_By_Single() { // var result = await _downloadDataAppService.SingleInterfaceDownload("SAPDataDownload", "READ_MATERIAL", "IM_WERKS=2000,IM_BEGDA=2020-04-01 00:00:00,2021-05-01 00:00:00"); // var result= await _saveDataAppService.SataData("READ_MATERIAL", resultjson); // result.code.ShouldBe(Contracts.Dtos.AnalyticState.SaveTooBusinessTableSuccess); //resultjson.ShouldContain("EX_LINES"); //JObject jobj = JObject.Parse(resultjson); //JToken result = jobj as JToken; ////这里6.0版块可以用正则匹配 //var node = result.SelectToken("$.." + "EX_LINES"); //var value = ""; //if (node != null) //{ // //判断节点类型 // if (node.Type == JTokenType.String || node.Type == JTokenType.Integer || node.Type == JTokenType.Float) // { // //返回string值 // value = node.Value().ToString(); // } //} //int.Parse(value).ShouldBeGreaterThan(-1); } } }