public static void Run() { //Bool - Test both cases //Random value would look correct 50% of the time var boolTag = BuildTag <BoolPlcMapper, bool>("TestBOOL"); TestTag(boolTag, true); TestTag(boolTag, false); //Signed Numbers TestTag(BuildTag <SintPlcMapper, sbyte>("TestSINT")); TestTag(BuildTag <IntPlcMapper, short>("TestINT")); TestTag(BuildTag <DintPlcMapper, int>("TestDINT")); TestTag(BuildTag <LintPlcMapper, long>("TestLINT")); //Logix doesn't support unsigned //Floating Points TestTag(BuildTag <RealPlcMapper, float>("TestREAL")); //TestTag(new GenericTag<PlcTypeLREAL, double>(gateway, Path, PlcType.Logix, "TestLREAL", timeout)); //String var tagString = BuildTag <StringPlcMapper, string>("TestSTRING"); TestTag(tagString, RandomValue.String(82)); //Arrays var tagArray = BuildTag <DintPlcMapper, int[]>("TestDINTArray"); tagArray.ArrayDimensions = new int[] { 5 }; TestTag(tagArray, RandomValue.Array <int>(5)); }
public async Task Test() { using var client = new HttpClient { BaseAddress = new Uri(_baseUrl) }; await Task.WhenAll(RandomValue.Array <object>(_maxParallelThreads).Select(_ => Crawl(client))); }
public static void Run() { //Bool - Test both cases //Random value would look correct 50% of the time var boolTag = BuildTag <BoolPlcMapper, bool>("TestBOOL"); TestTag(boolTag, true); TestTag(boolTag, false); //Signed Numbers TestTag(BuildTag <SintPlcMapper, sbyte>("TestSINT")); TestTag(BuildTag <IntPlcMapper, short>("TestINT")); TestTag(BuildTag <DintPlcMapper, int>("TestDINT")); TestTag(BuildTag <LintPlcMapper, long>("TestLINT")); //Logix doesn't support unsigned //Floating Points TestTag(BuildTag <RealPlcMapper, float>("TestREAL")); //TestTag(new GenericTag<PlcTypeLREAL, double>(gateway, Path, PlcType.Logix, "TestLREAL", timeout)); //Arrays //var testArray = new int[] {37, 38, 39, 40, 50 }; var testArray = RandomValue.Array <int>(5); var tagArray = new Tag <DintPlcMapper, int[]>() { Name = "TestDINTArray", Gateway = GATEWAY, Path = PATH, PlcType = PLC_TYPE, Protocol = PROTOCOL, Timeout = TimeSpan.FromMilliseconds(DEFAULT_TIMEOUT), ArrayDimensions = new int[] { 5 }, }; tagArray.Initialize(); TestTag(tagArray, testArray); }
public void RandomArrayWithRecursiveWillGenerateChildObjectsToTheSpecifiedDepthWithSettings() { var result = RandomValue.Array <ObjectWithRecursiveCollections>(Depth2Settings); result.Count().ShouldBeInRange(1, 3); var depth1 = result.FirstOrDefault(); depth1.RecursiveArray.ShouldNotBeDefault(); depth1.Int.ShouldNotBeDefault(); depth1.RecursiveArray.Length.ShouldBeInRange(1, 3); var depth2 = depth1.RecursiveArray.FirstOrDefault(); depth2.RecursiveArray.ShouldNotBeDefault(); depth2.Int.ShouldNotBeDefault(); depth2.RecursiveArray.Length.ShouldBeInRange(1, 3); var depth3 = depth2.RecursiveArray.FirstOrDefault(); depth3.RecursiveArray.ShouldEqual(null); depth3.Int.ShouldNotBeDefault(); }