private static IOModuleInfo GetModuleInfoForTest( string expectedName = null) { const int IntStub = 0; const string StrStub = ""; const string ColorStub = "White"; string name = expectedName ?? string.Empty; IOModuleInfo.AddModuleInfo(IntStub, name, StrStub, IntStub, StrStub, StrStub, new int[0], new int[0], new int[0], IntStub, IntStub, IntStub, IntStub, ColorStub); return(IOModuleInfo.GetModuleInfo(name, out _)); }
private static void FillRandomModulesInfo(int count, int repeatableCount = 0) { int currentCount = count; int currentRepeatableCount = repeatableCount; int enumSize = Enum .GetValues(typeof(IOModuleInfo.ADDRESS_SPACE_TYPE)).Length; List <KnownColor> colors = Enum.GetValues(typeof(KnownColor)) .Cast <KnownColor>() .ToList(); while (currentCount > 0) { int n = GetRandomIntNumber(); string name = GetRandomString(5); string description = GetRandomString(10); int addressSpaceTypeNum = new Random().Next(0, enumSize); string typeName = GetRandomString(10); string groupName = GetRandomString(7); int[] channelClamps = GetRandomIntArr(); int[] channelAddressesIn = GetRandomIntArr(); int[] channelAddressesOut = GetRandomIntArr(); int DOCount = GetRandomIntNumber(); int DICount = GetRandomIntNumber(); int AOCount = GetRandomIntNumber(); int AICount = GetRandomIntNumber(); string color = colors[new Random().Next(0, colors.Count - 1)] .ToString(); while (currentRepeatableCount > 1) { IOModuleInfo.AddModuleInfo(n, name, description, addressSpaceTypeNum, typeName, groupName, channelClamps, channelAddressesIn, channelAddressesOut, DOCount, DICount, AOCount, AICount, color); currentRepeatableCount--; currentCount--; } IOModuleInfo.AddModuleInfo(n, name, description, addressSpaceTypeNum, typeName, groupName, channelClamps, channelAddressesIn, channelAddressesOut, DOCount, DICount, AOCount, AICount, color); currentCount--; } }