private void Button_Click(object sender, RoutedEventArgs e) { try { string firstPawPrint = this.txtFirstPawPrint.Text; string secodPawPrint = this.txtSecodPawPrint.Text; int acceptanceParameter = int.Parse(this.txtAcceptanceParameter.Text); if (string.IsNullOrEmpty(firstPawPrint) || string.IsNullOrEmpty(secodPawPrint) || acceptanceParameter <= 0) { MessageBox.Show("Alguno de los valores de entrada es incorrecto por favor valide nuevamente"); } else { this.txtResult.Text = ""; DataTest data = new DataTest() { FirstPawPrint = firstPawPrint, SecodPawPrint = secodPawPrint, AcceptanceParameter = acceptanceParameter }; CalculateMatch newMarch = new CalculateMatch(data); this.txtResult.Text = newMarch.GetValidation(); } } catch (Exception ex) { MessageBox.Show("Se genero un error al realizar la válidación por favor intente nuevamente"); } }
public override global::System.Data.DataSet Clone() { DataTest cln = ((DataTest)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e) { List <DataTest> list = new List <DataTest>(); DataTest t1 = new DataTest(); t1.aa = "aa1"; t1.bb = "bb1"; }
static void Main(string[] args) { //ClassTester ct = new ClassTester(); //ct.Test(); //Console.ReadLine(); DataTest dt = new DataTest(); dt.TestReadAll(); dt.TestReadOne(); }
public void TestFirstPawPrint(string firstPawPrint, string secodPawPrint, int acceptanceParameter, string spectedValue) { DataTest data = new DataTest() { FirstPawPrint = firstPawPrint, SecodPawPrint = secodPawPrint, AcceptanceParameter = acceptanceParameter, SpectedValue = spectedValue }; CalculateMatch newMarch = new CalculateMatch(data); string result = newMarch.GetValidation(); Assert.True(data.SpectedValue.Equals(result)); }
public CalculateMatch(DataTest data) { if (data.FirstPawPrint.Length < data.AcceptanceParameter || data.FirstPawPrint.Length < data.AcceptanceParameter) { Result = "NO-HIT"; } else { int counter = 0; Result = Iteration(data.FirstPawPrint, data.SecodPawPrint, data.AcceptanceParameter, counter); } }
public IHttpActionResult PostNumber(DataTest datanumber, ModelNumber datanumbermodel) { var DataNumber = new DataTest() { number = datanumber.number, NameNumber = datanumber.NameNumber }; var DataNumberModel = new ModelNumber() { }; return(Ok(DataNumber)); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { DataTest ds = new DataTest(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public LogIn() { InitializeComponent(); DataTest.Insert(); DataTest.InitialiseEmployee(); Boss b = new Boss("admin", "password"); b.Id = "111A"; blEmployees.InsertEmployees(b); blStock.AllItemsInserted(); blServices.AllServices(); }
public static void Main(string[] args) { Server server = new Server { Services = { DataTest.BindService(new MyServiceImpl()) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("grpc server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); server.ShutdownAsync().Wait(); }
static void Main(string[] args) { try { DataTest.Run(); //SetterTest.Run(); } catch (Exception e) { throw e; } finally { Console.ReadKey(); } }
public void SortString() { string s1 = "1;2;3;4;5;6;7;8;9;10;11;12"; int[] s1Result = new int[] { 2, 4, 6, 8, 10, 12 }; string s2 = "34;45;52352;323;32"; int[] s2Result = new int[] { 34, 52352, 32 }; DataTest test = new DataTest(); int[] s1Actual = test.SortString(s1); int[] s2Actual = test.SortString(s2); CollectionAssert.AreEqual(s1Result, s1Actual); CollectionAssert.AreEqual(s2Result, s2Actual); }
public static void Main(string[] args) { var hostServer = CreateHostBuilder(args).Build(); using (var ambient = hostServer.Services.CreateScope()){ var services = ambient.ServiceProvider; try{ var userManager = services.GetRequiredService <UserManager <User> >(); var context = services.GetRequiredService <CoursesOnLineContext>(); context.Database.Migrate(); DataTest.InsertData(context, userManager).Wait(); } catch (Exception e) { var logging = services.GetRequiredService <ILogger <Program> >(); logging.LogError(e, "Ocurrio un error en la migracion"); } } hostServer.Run(); }
public static void Main(string[] args) { var hostserver = CreateHostBuilder(args).Build(); //Se realiza la migración hacia la base de datos using (var environment = hostserver.Services.CreateScope()){ var services = environment.ServiceProvider; try{ var userManager = services.GetRequiredService <UserManager <User> >(); var context = services.GetRequiredService <AgreementContext>(); context.Database.Migrate(); DataTest.InsertData(context, userManager).Wait(); }catch (Exception e) { var logging = services.GetRequiredService <ILogger <Program> >(); logging.LogError(e, "Ocurrio un error en la migración"); } } hostserver.Run(); }
public static void Main(string[] args) { var hostserver = CreateHostBuilder(args).Build(); using (var ambiente = hostserver.Services.CreateScope()) { var services = ambiente.ServiceProvider; try { var userManaget = services.GetRequiredService <UserManager <Usuario> >(); var context = services.GetRequiredService <PruebaBdContext>(); context.Database.Migrate(); DataTest.Insertar(context, userManaget).Wait(); } catch (Exception e) { var logging = services.GetRequiredService <ILogger <Program> >(); logging.LogError(e, "Error en migracion"); } hostserver.Run(); } }
private void OnSelectedFollowView(DataTest data) { //await App.Current.MainPage.DisplayAlert("", data.Title +"_", "OK"); // await App.Current.MainPage.Navigation.PushAsync(new FollowPage()); }
public async Task SiemensUnitTest( ) { SiemensS7Net plc = new SiemensS7Net(SiemensPLCS.S1200, "192.168.8.12"); // "192.168.8.12" if (!plc.ConnectServer( ).IsSuccess) { Console.WriteLine("无法连接PLC,将跳过单元测试。等待网络正常时,再进行测试"); return; } // 开始单元测试,从bool类型开始测试 string address = "M200.4"; Assert.IsTrue(plc.Write(address, true).IsSuccess); Assert.IsTrue(plc.ReadBool(address).Content == true); address = "M300"; // short类型 Assert.IsTrue(plc.Write(address, (short)12345).IsSuccess); Assert.IsTrue(plc.ReadInt16(address).Content == 12345); short[] shortTmp = new short[] { 123, 423, -124, 5313, 2361 }; Assert.IsTrue(plc.Write(address, shortTmp).IsSuccess); short[] readShort = plc.ReadInt16(address, (ushort)shortTmp.Length).Content; for (int i = 0; i < readShort.Length; i++) { Assert.IsTrue(readShort[i] == shortTmp[i]); } // 异步short类型 for (int j = 0; j < 100; j++) { Assert.IsTrue((await plc.WriteAsync(address, (short)12345)).IsSuccess); Assert.IsTrue((await plc.ReadInt16Async(address)).Content == 12345); Assert.IsTrue((await plc.WriteAsync(address, shortTmp)).IsSuccess); readShort = (await plc.ReadInt16Async(address, (ushort)shortTmp.Length)).Content; for (int i = 0; i < readShort.Length; i++) { Assert.IsTrue(readShort[i] == shortTmp[i]); } } // ushort类型 Assert.IsTrue(plc.Write(address, (ushort)51234).IsSuccess); Assert.IsTrue(plc.ReadUInt16(address).Content == 51234); ushort[] ushortTmp = new ushort[] { 5, 231, 12354, 5313, 12352 }; Assert.IsTrue(plc.Write(address, ushortTmp).IsSuccess); ushort[] readUShort = plc.ReadUInt16(address, (ushort)ushortTmp.Length).Content; for (int i = 0; i < ushortTmp.Length; i++) { Assert.IsTrue(readUShort[i] == ushortTmp[i]); } // int类型 Assert.IsTrue(plc.Write(address, 12342323).IsSuccess); Assert.IsTrue(plc.ReadInt32(address).Content == 12342323); int[] intTmp = new int[] { 123812512, 123534, 976124, -1286742 }; Assert.IsTrue(plc.Write(address, intTmp).IsSuccess); int[] readint = plc.ReadInt32(address, (ushort)intTmp.Length).Content; for (int i = 0; i < intTmp.Length; i++) { Assert.IsTrue(readint[i] == intTmp[i]); } // uint类型 Assert.IsTrue(plc.Write(address, (uint)416123237).IsSuccess); Assert.IsTrue(plc.ReadUInt32(address).Content == (uint)416123237); uint[] uintTmp = new uint[] { 81623123, 91712749, 91273123, 123, 21242, 5324 }; Assert.IsTrue(plc.Write(address, uintTmp).IsSuccess); uint[] readuint = plc.ReadUInt32(address, (ushort)uintTmp.Length).Content; for (int i = 0; i < uintTmp.Length; i++) { Assert.IsTrue(readuint[i] == uintTmp[i]); } // float类型 Assert.IsTrue(plc.Write(address, 123.45f).IsSuccess); Assert.IsTrue(plc.ReadFloat(address).Content == 123.45f); float[] floatTmp = new float[] { 123, 5343, 1.45f, 563.3f, 586.2f }; Assert.IsTrue(plc.Write(address, floatTmp).IsSuccess); float[] readFloat = plc.ReadFloat(address, (ushort)floatTmp.Length).Content; for (int i = 0; i < readFloat.Length; i++) { Assert.IsTrue(floatTmp[i] == readFloat[i]); } // double类型 Assert.IsTrue(plc.Write(address, 1234.5434d).IsSuccess); Assert.IsTrue(plc.ReadDouble(address).Content == 1234.5434d); double[] doubleTmp = new double[] { 1.4213d, 1223d, 452.5342d, 231.3443d }; Assert.IsTrue(plc.Write(address, doubleTmp).IsSuccess); double[] readDouble = plc.ReadDouble(address, (ushort)doubleTmp.Length).Content; for (int i = 0; i < doubleTmp.Length; i++) { Assert.IsTrue(readDouble[i] == doubleTmp[i]); } // long类型 Assert.IsTrue(plc.Write(address, 123617231235123L).IsSuccess); Assert.IsTrue(plc.ReadInt64(address).Content == 123617231235123L); long[] longTmp = new long[] { 12312313123L, 1234L, 412323812368L, 1237182361238123 }; Assert.IsTrue(plc.Write(address, longTmp).IsSuccess); long[] readLong = plc.ReadInt64(address, (ushort)longTmp.Length).Content; for (int i = 0; i < longTmp.Length; i++) { Assert.IsTrue(readLong[i] == longTmp[i]); } // ulong类型 Assert.IsTrue(plc.Write(address, 1283823681236123UL).IsSuccess); Assert.IsTrue(plc.ReadUInt64(address).Content == 1283823681236123UL); ulong[] ulongTmp = new ulong[] { 21316UL, 1231239127323UL, 1238612361283123UL }; Assert.IsTrue(plc.Write(address, ulongTmp).IsSuccess); ulong[] readULong = plc.ReadUInt64(address, (ushort)ulongTmp.Length).Content; for (int i = 0; i < readULong.Length; i++) { Assert.IsTrue(readULong[i] == ulongTmp[i]); } // string类型 Assert.IsTrue(plc.Write(address, "123123").IsSuccess); Assert.IsTrue(plc.ReadString(address).Content == "123123"); // 中文,编码可以自定义 Assert.IsTrue(plc.Write(address, "测试信息123", Encoding.Unicode).IsSuccess); Assert.IsTrue(plc.ReadString(address, 14, Encoding.Unicode).Content == "测试信息123"); // byte类型 byte[] byteTmp = new byte[] { 0x4F, 0x12, 0x72, 0xA7, 0x54, 0xB8 }; Assert.IsTrue(plc.Write(address, byteTmp).IsSuccess); Assert.IsTrue(SoftBasic.IsTwoBytesEquel(plc.Read(address, 6).Content, byteTmp)); // 批量写入测试 short[] shortValues = new short[50]; for (int i = 0; i < 50; i++) { shortValues[i] = (short)(i * 5 - 3); } Assert.IsTrue(plc.Write("M300", shortValues).IsSuccess); string[] addresses = new string[50]; ushort[] lengths = new ushort[50]; for (int i = 0; i < 50; i++) { addresses[i] = "M" + (i * 2 + 300); lengths[i] = 2; } OperateResult <byte[]> readBytes = plc.Read(addresses, lengths); Assert.IsTrue(readBytes.IsSuccess); Assert.IsTrue(readBytes.Content.Length == 100); for (int i = 0; i < 50; i++) { short shortTmp1 = plc.ByteTransform.TransInt16(readBytes.Content, i * 2); Assert.IsTrue(shortValues[i] == shortTmp1); } // 自定义类的测试 DataTest test = new DataTest( ) { Data1 = 425, Data2 = 123.53f, Data3 = new byte[] { 2, 4, 6, 8, 100, 123 } }; Assert.IsTrue(plc.Write(test).IsSuccess); Assert.IsTrue(plc.ReadInt16("M100").Content == 425); Assert.IsTrue(plc.ReadFloat("M200").Content == 123.53f); Assert.IsTrue(SoftBasic.IsTwoBytesEquel(plc.Read("M300", 6).Content, test.Data3)); DataTest test1 = plc.Read <DataTest>( ).Content; Assert.IsTrue(test1.Data1 == test.Data1); Assert.IsTrue(test1.Data2 == test.Data2); Assert.IsTrue(SoftBasic.IsTwoBytesEquel(test1.Data3, test.Data3)); // 大数据写入测试 Assert.IsTrue(plc.Write("M100", (short)12345).IsSuccess); Assert.IsTrue(plc.Write("M500", (short)12345).IsSuccess); Assert.IsTrue(plc.Write("M800", (short)12345).IsSuccess); OperateResult <short[]> readBatchResult = plc.ReadInt16("M100", 351); Assert.IsTrue(readBatchResult.IsSuccess); Assert.IsTrue(readBatchResult.Content[0] == 12345); Assert.IsTrue(readBatchResult.Content[200] == 12345); Assert.IsTrue(readBatchResult.Content[350] == 12345); plc.ConnectClose( ); }
private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e) { List<DataTest> list = new List<DataTest>(); DataTest t1 = new DataTest(); t1.aa = "aa1"; t1.bb = "bb1"; }
public void SetupToSuccees() => this.Setup(x => x.IsMatch(It.IsAny <string>(), DataTest.GetRegex())).Returns(true);
public JsonToNodeData() { DataShowDB = new DataShowDB(); DataTest = new DataTest(); }
public void SetupToFail() => this.Setup(x => x.IsMatch(It.IsAny <string>(), DataTest.GetRegex())).Returns(false);
public string GetData() { DataTest dataTest = new DataTest(); return(dataTest.Getdata()); }
public DataShowCore() { DataShowDB = new DataShowDB(); DataTest = new DataTest(); }
public static void setData(DataTest source) { _source = source; }