public void PerformanceTest() { CSharpScriptTransform transform = new CSharpScriptTransform(); transform.ScriptText = @" using System; using System.Collections.Generic; using System.Linq; using System.Xml; using Lithnet.Transforms; using Microsoft.MetadirectoryServices; public static class CSExtension { public static IList<object> Transform(IList<object> obj) { return new List<object>() { obj.First() }; } }"; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("1", transform.TransformValue("1").First()); }, 130000); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); DateConverterTransform transformToSeralize = new DateConverterTransform(); transformToSeralize.ID = "test001"; transformToSeralize.InputDateType = DateType.FimServiceString; transformToSeralize.InputFormat = "abc"; transformToSeralize.InputTimeZone = TimeZoneInfo.Utc; transformToSeralize.CalculationOperator = DateOperator.Add; transformToSeralize.CalculationTimeSpanType = TimeSpanType.Hours; transformToSeralize.CalculationValue = 6; transformToSeralize.OutputDateType = DateType.String; transformToSeralize.OutputFormat = "def"; transformToSeralize.OutputTimeZone = TimeZoneInfo.Local; UniqueIDCache.ClearIdCache(); DateConverterTransform deserializedTransform = (DateConverterTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.InputDateType, deserializedTransform.InputDateType); Assert.AreEqual(transformToSeralize.InputFormat, deserializedTransform.InputFormat); Assert.AreEqual(transformToSeralize.InputTimeZone, deserializedTransform.InputTimeZone); Assert.AreEqual(transformToSeralize.CalculationOperator, deserializedTransform.CalculationOperator); Assert.AreEqual(transformToSeralize.CalculationTimeSpanType, deserializedTransform.CalculationTimeSpanType); Assert.AreEqual(transformToSeralize.CalculationValue, deserializedTransform.CalculationValue); Assert.AreEqual(transformToSeralize.OutputFormat, deserializedTransform.OutputFormat); Assert.AreEqual(transformToSeralize.OutputDateType, deserializedTransform.OutputDateType); Assert.AreEqual(transformToSeralize.OutputTimeZone, deserializedTransform.OutputTimeZone); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); TransformKeyedCollection objectToSerialize = new TransformKeyedCollection(); StringCaseTransform transform1 = new StringCaseTransform(); transform1.ID = "tx0001"; transform1.StringCase = StringCaseType.Title; GetDNComponentTransform transform2 = new GetDNComponentTransform(); transform2.ID = "tx0002"; transform2.RdnFormat = RdnFormat.ValueOnly; transform2.ComponentIndex = 1; objectToSerialize.Add(transform1); objectToSerialize.Add(transform2); UniqueIDCache.ClearIdCache(); TransformKeyedCollection deserializedObject = (TransformKeyedCollection)UnitTestControl.XmlSerializeRoundTrip <TransformKeyedCollection>(objectToSerialize); Assert.AreEqual(objectToSerialize.Count, deserializedObject.Count); Assert.AreEqual(objectToSerialize[0].ID, transform1.ID); Assert.AreEqual(objectToSerialize[1].ID, transform2.ID); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); SimpleLookupTransform transformToSeralize = new SimpleLookupTransform(); transformToSeralize.DefaultValue = "A"; transformToSeralize.LookupItems.Add(new LookupItem() { CurrentValue = "test1", NewValue = "test2" }); transformToSeralize.LookupItems.Add(new LookupItem() { CurrentValue = "test3", NewValue = "test4" }); transformToSeralize.OnMissingMatch = OnMissingMatch.UseNull; transformToSeralize.UserDefinedReturnType = ExtendedAttributeType.Binary; transformToSeralize.ID = "test001"; UniqueIDCache.ClearIdCache(); SimpleLookupTransform deserializedTransform = (SimpleLookupTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.DefaultValue, deserializedTransform.DefaultValue); Assert.AreEqual(transformToSeralize.OnMissingMatch, deserializedTransform.OnMissingMatch); Assert.AreEqual(transformToSeralize.UserDefinedReturnType, deserializedTransform.UserDefinedReturnType); CollectionAssert.AreEqual(transformToSeralize.LookupItems, deserializedTransform.LookupItems, new LookupItemComparer()); }
public void PerformanceTest() { MVBooleanToBitmaskTransform transform = new MVBooleanToBitmaskTransform(); transform.Flags.Add(new FlagValue() { Value = 2 }); transform.Flags.Add(new FlagValue() { Value = 4 }); UnitTestControl.PerformanceTest(() => { Assert.AreEqual(518L, transform.TransformValuesWithLoopback( new List <object>() { true, true }, new List <object>() { 512 } ).First()); }, 350000); }
public void PerformanceTest() { ADGroupScopeToStringTransform transform = new ADGroupScopeToStringTransform(); UnitTestControl.PerformanceTest(() => { Assert.AreEqual("Global", transform.TransformValue(-2147483646).First()); }, 700000); }
public void PerformanceTest() { BitmaskToBooleanTransform transform = new BitmaskToBooleanTransform(); transform.Flag = 2; UnitTestControl.PerformanceTest(() => { Assert.AreEqual(true, transform.TransformValue(514).First()); }, 900000); }
public void PerformanceTest() { StringCaseTransform transform = new StringCaseTransform(); transform.StringCase = StringCaseType.Lower; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("this is a test", transform.TransformValue("THIS is a TEST").First()); }, 400000); }
public void PerformanceTest() { FormatStringTransform transform = new FormatStringTransform(); transform.Format = "Value is: {0}"; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("Value is: Test", transform.TransformValue("Test").First()); }, 800000); }
public void PerformanceTest() { PowerShellScriptTransform transform = new PowerShellScriptTransform(); transform.ScriptPath = @"..\..\TestData\Transform-String.ps1"; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("THINGS & STUFF", transform.TransformValue("Things & stuff").First()); }, 100000, 30000); }
public void PerformanceTestLdap() { StringEscapeTransform transform = new StringEscapeTransform(); transform.EscapeType = StringEscapeType.LdapDN; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("Department of\\, IT", transform.TransformValue("Department of, IT").First()); }, 250000); }
public void PerformanceTest() { GetDNComponentTransform transform = new GetDNComponentTransform(); transform.ComponentIndex = 1; transform.RdnFormat = RdnFormat.ValueOnly; transform.Direction = Direction.Left; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("Test user", transform.TransformValue("cn=Test user, ou=Organisation").First()); }, 200000); }
public void PerformanceTest() { RegexReplaceTransform transform = new RegexReplaceTransform(); transform.FindPattern = @"[^a-zA-Z\-]"; transform.ReplacePattern = string.Empty; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("Ryan", transform.TransformValue("Ry^*an").First()); }, 250000); }
public void PerformanceTest() { BitmaskTransform transform = new BitmaskTransform(); transform.Flag = 2; transform.Operation = BitwiseOperation.Or; UnitTestControl.PerformanceTest(() => { Assert.AreEqual(514L, transform.TransformValue(512).First()); }, 900000); }
public void PerformanceTest() { GroupStringsToADGroupTypeTransform transform = new GroupStringsToADGroupTypeTransform(); UnitTestControl.PerformanceTest(() => { Assert.AreEqual(-2147483646L, transform.TransformValue(new List <object>() { "Security", "Global" }).First()); }, 300000); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); ConcatStringTransform transformToSeralize = new ConcatStringTransform(); transformToSeralize.ID = "test001"; transformToSeralize.Delimiter = ","; UniqueIDCache.ClearIdCache(); ConcatStringTransform deserializedTransform = (ConcatStringTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.Delimiter, deserializedTransform.Delimiter); }
public void PerformanceTest() { ConcatStringTransform transform = new ConcatStringTransform(); transform.Delimiter = ","; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("test1,test2,test3", transform.TransformValue(new List <object>() { "test1", "test2", "test3" }).First()); }, 200000); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); StringCaseTransform transformToSeralize = new StringCaseTransform(); transformToSeralize.ID = "test001"; transformToSeralize.StringCase = StringCaseType.Title; UniqueIDCache.ClearIdCache(); StringCaseTransform deserializedTransform = (StringCaseTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.StringCase, deserializedTransform.StringCase); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); StringSplitTransform transformToSeralize = new StringSplitTransform(); transformToSeralize.ID = "test001"; transformToSeralize.SplitRegex = ","; UniqueIDCache.ClearIdCache(); StringSplitTransform deserializedTransform = (StringSplitTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.SplitRegex, deserializedTransform.SplitRegex); }
public void PerformanceTest() { DateConverterTransform transform = new DateConverterTransform(); transform.InputTimeZone = TimeZoneInfo.Utc; transform.InputDateType = DateType.FimServiceString; transform.OutputTimeZone = TimeZoneInfo.Local; transform.OutputDateType = DateType.Ticks; UnitTestControl.PerformanceTest(() => { Assert.AreEqual(new DateTime(2014, 1, 2, 10, 0, 0, DateTimeKind.Utc).ToLocalTime().Ticks, transform.TransformValue("2014-01-02T10:00:00.000").First()); }, 80000); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); SidToDomainTransform transformToSeralize = new SidToDomainTransform(); transformToSeralize.ID = "test001"; transformToSeralize.Format = DomainFormat.DomainName; UniqueIDCache.ClearIdCache(); SidToDomainTransform deserializedTransform = (SidToDomainTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.Format, deserializedTransform.Format); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); TrimStringTransform transformToSeralize = new TrimStringTransform(); transformToSeralize.ID = "test001"; transformToSeralize.TrimType = TrimType.Both; UniqueIDCache.ClearIdCache(); TrimStringTransform deserializedTransform = (TrimStringTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.TrimType, deserializedTransform.TrimType); }
public void PerformanceTest() { SidStringBiDirectionalTransform transform = new SidStringBiDirectionalTransform(); SecurityIdentifier sid = WindowsIdentity.GetCurrent().User; byte[] sidbytes = new byte[sid.BinaryLength]; sid.GetBinaryForm(sidbytes, 0); UnitTestControl.PerformanceTest(() => { Assert.AreEqual(sid.Value, transform.TransformValue(sidbytes).First()); }, 170000); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); FormatStringTransform transformToSeralize = new FormatStringTransform(); transformToSeralize.ID = "test001"; transformToSeralize.Format = "{0}\n{1}"; UniqueIDCache.ClearIdCache(); FormatStringTransform deserializedTransform = (FormatStringTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.Format, deserializedTransform.Format); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); ValueMergeTransform transformToSeralize = new ValueMergeTransform(); transformToSeralize.ID = "test001"; transformToSeralize.UserDefinedReturnType = ExtendedAttributeType.Integer; UniqueIDCache.ClearIdCache(); ValueMergeTransform deserializedTransform = (ValueMergeTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.UserDefinedReturnType, deserializedTransform.UserDefinedReturnType); }
public void PerformanceTest() { BooleanOperationTransform transform = new BooleanOperationTransform(); transform.ID = Guid.NewGuid().ToString(); transform.Operator = BitwiseOperation.Xor; UnitTestControl.PerformanceTest(() => { Assert.AreEqual(false, transform.TransformValue(new List <object>() { true, true, false }).First()); }, 250000); }
public void PerformanceTest() { MultivalueToSingleValueTransform transform = new MultivalueToSingleValueTransform(); transform.SelectorOperator = ValueOperator.Equals; transform.SelectorValue = "Ryan"; transform.CompareAs = ExtendedAttributeType.String; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("Ryan", transform.TransformValue(new List <object>() { "Bob", "Ryan" }).First()); }, 200000); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); RegexReplaceTransform transformToSeralize = new RegexReplaceTransform(); transformToSeralize.ID = "test001"; transformToSeralize.FindPattern = "zz"; transformToSeralize.ReplacePattern = "aa"; UniqueIDCache.ClearIdCache(); RegexReplaceTransform deserializedTransform = (RegexReplaceTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.FindPattern, deserializedTransform.FindPattern); Assert.AreEqual(transformToSeralize.ReplacePattern, deserializedTransform.ReplacePattern); }
public void TestSerialization() { UniqueIDCache.ClearIdCache(); BitmaskTransform transformToSeralize = new BitmaskTransform(); transformToSeralize.ID = "test001"; transformToSeralize.Flag = 2; transformToSeralize.Operation = BitwiseOperation.And; UniqueIDCache.ClearIdCache(); BitmaskTransform deserializedTransform = (BitmaskTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize); Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID); Assert.AreEqual(transformToSeralize.Flag, deserializedTransform.Flag); Assert.AreEqual(transformToSeralize.Operation, deserializedTransform.Operation); }
public void PerformanceTest() { DelimitedTextFileLookupTransform transform = new DelimitedTextFileLookupTransform(); transform.FileName = @"..\..\TestData\OUMappings.tsv"; transform.HasHeaderRow = false; transform.FindColumn = 0; transform.ReplaceColumn = 1; transform.OnMissingMatch = OnMissingMatch.UseOriginal; transform.DelimiterType = DelimiterType.TabSeparated; transform.UserDefinedReturnType = ExtendedAttributeType.String; UnitTestControl.PerformanceTest(() => { Assert.AreEqual("MyName", transform.TransformValue("1234").First()); }, 300000); }