Example #1
0
        public void TestLoopbackExportTransform()
        {
            MVBooleanToBitmaskTransform tx = new MVBooleanToBitmaskTransform();

            tx.ID           = "BBT2";
            tx.DefaultValue = 768;
            tx.Flags.Add(new FlagValue()
            {
                Name = "Test", Value = 2
            });

            this.re.config.Transforms.Add(tx);

            this.ExecuteExportLoopbackTest(
                AttributeType.Boolean,
                AttributeType.Integer,
                new List <Transform>()
            {
                tx
            },
                514L,
                512,
                true
                );
        }
Example #2
0
        public void TestLoopbackImportTransformWithNullTargetValue()
        {
            MVBooleanToBitmaskTransform tx = new MVBooleanToBitmaskTransform
            {
                ID           = "BBT",
                DefaultValue = 768
            };

            tx.Flags.Add(new FlagValue()
            {
                Name = "Test", Value = 2
            });

            this.re.config.Transforms.Add(tx);

            this.ExecuteImportLoopbackTest(
                AttributeType.Boolean,
                AttributeType.Integer,
                new List <Transform>()
            {
                tx
            },
                770L,
                null,
                true
                );
        }
Example #3
0
        public void TestSerialization()
        {
            UniqueIDCache.ClearIdCache();
            MVBooleanToBitmaskTransform transformToSeralize = new MVBooleanToBitmaskTransform();

            transformToSeralize.ID = "test001";
            transformToSeralize.Flags.Add(new FlagValue()
            {
                Name = "AccountDisabled", Value = 2
            });
            transformToSeralize.Flags.Add(new FlagValue()
            {
                Name = "DontExpirePassword", Value = 65535
            });
            transformToSeralize.DefaultValue = 512;
            UniqueIDCache.ClearIdCache();

            MVBooleanToBitmaskTransform deserializedTransform = (MVBooleanToBitmaskTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize);

            Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID);
            Assert.AreEqual(transformToSeralize.Flags[0].Name, deserializedTransform.Flags[0].Name);
            Assert.AreEqual(transformToSeralize.Flags[1].Name, deserializedTransform.Flags[1].Name);
            Assert.AreEqual(transformToSeralize.Flags[0].Value, deserializedTransform.Flags[0].Value);
            Assert.AreEqual(transformToSeralize.Flags[1].Value, deserializedTransform.Flags[1].Value);
            Assert.AreEqual(transformToSeralize.DefaultValue, deserializedTransform.DefaultValue);
        }
Example #4
0
        public void BitmaskLoopbackInputTestMV()
        {
            MVBooleanToBitmaskTransform transform = new MVBooleanToBitmaskTransform();

            transform.Flags.Add(new FlagValue()
            {
                Value = 2
            });
            transform.Flags.Add(new FlagValue()
            {
                Value = 4
            });

            this.ExecuteTestBitwiseTransformLoopbackInput(transform, 512, new List <object>()
            {
                true, true
            }, 518);
            this.ExecuteTestBitwiseTransformLoopbackInput(transform, 514, new List <object>()
            {
                false, true
            }, 516);
            this.ExecuteTestBitwiseTransformLoopbackInput(transform, 512, new List <object>()
            {
                false, false
            }, 512);
            this.ExecuteTestBitwiseTransformLoopbackInput(transform, 514, new List <object>()
            {
                true, false
            }, 514);
        }
Example #5
0
        public void BitmaskLoopbackInputTestWithNullPrimaryInput()
        {
            MVBooleanToBitmaskTransform transform = new MVBooleanToBitmaskTransform();

            transform.Flags.Add(new FlagValue()
            {
                Value = 2
            });

            transform.DefaultValue = 512;

            this.ExecuteTestBitwiseTransformLoopbackInput(transform, null, new List <object>()
            {
                true
            }, 514);
            this.ExecuteTestBitwiseTransformLoopbackInput(transform, null, new List <object>()
            {
                false
            }, 512);
            this.ExecuteTestBitwiseTransformLoopbackInput(transform, null, new List <object>()
            {
                false
            }, 512);
            this.ExecuteTestBitwiseTransformLoopbackInput(transform, null, new List <object>()
            {
                true
            }, 514);
        }
Example #6
0
        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);
        }
Example #7
0
        public FlowRuleParameterTests()
        {
            UniqueIDCache.ClearIdCache();

            this.config = new XmlConfigFile();
            GetDNComponentTransform transform1 = new GetDNComponentTransform();

            transform1.ID = "xform1";
            this.config.Transforms.Add(transform1);

            GetDNComponentTransform transform2 = new GetDNComponentTransform();

            transform2.ID = "xform2";
            this.config.Transforms.Add(transform2);

            MVBooleanToBitmaskTransform transform3 = new MVBooleanToBitmaskTransform();

            transform3.ID = "loopback";
            this.config.Transforms.Add(transform3);

            FlowRuleAlias alias1 = new FlowRuleAlias();

            alias1.Alias = "alias1";
            alias1.FlowRuleDefinition = "csattribute>>xform1>>mvattribute";
            this.config.FlowRuleAliases.Add(alias1);

            FlowRuleAlias alias2 = new FlowRuleAlias();

            alias2.Alias = "alias2";
            alias2.FlowRuleDefinition = "csattribute>>xform2>>mvattribute";
            this.config.FlowRuleAliases.Add(alias2);
        }
        public MVBooleanToBitmaskTransformViewModel(MVBooleanToBitmaskTransform model)
            : base(model)
        {
            this.model = model;

            if (this.model.Flags == null)
            {
                this.model.Flags = new List <FlagValue>();
            }

            this.Flags = new BindingList <FlagValue>(this.model.Flags);
        }
Example #9
0
        private void ExecuteTestBitwiseTransformLoopbackInput(MVBooleanToBitmaskTransform transform, object targetValue, IList <object> inputValues, long expectedValue)
        {
            IList <object> result = transform.TransformValuesWithLoopback(inputValues, new List <object>()
            {
                targetValue
            });

            if (result.Count == 0)
            {
                Assert.Fail("Not results were returned");
            }
            else if (result.Count > 1)
            {
                Assert.Fail("Too many results were returned");
            }

            long outValue = (long)result.First();

            Assert.AreEqual(expectedValue, outValue);
        }