Example #1
0
        public void Should_Use_Custom_Boundaries_for_Integer_Value_Injection()
        {
            //Create an instance of our test class
            var testInstance = new IntegerTestClass();

            var intMax = 10;
            var intMin = 1;

            //Create an instance of our IntSelector and set some custom bounds
            var selector =
                new IntSelector().SetMax(() => Faker.Generators.Numbers.Int(intMax, intMax))
                                 .SetMin(() => Faker.Generators.Numbers.Int(intMin, intMin));

            //Iterate over the test object's properties
            foreach (var property in testInstance.GetType().GetProperties())
            {
                Assert.IsTrue(selector.CanBind(property),
                              string.Format("should have been able to bind to property {0}", property.Name));

                //Inject the value into this property on our test instance class
                selector.Generate(testInstance, property);

                //Get the value out of the property
                var fieldValue = (int)property.GetValue(testInstance, null);
                Assert.IsNotNull(fieldValue);
                Assert.AreNotEqual(fieldValue, default(int));
                Assert.IsTrue(fieldValue <= intMax && fieldValue >= intMin, "Custom range should have worked");
            }
        }
Example #2
0
        public void IntSelectorClone()
        {
            tlog.Debug(tag, $"IntSelectorClone START");

            var testingTarget = new IntSelector()
            {
                All = 10,
            };

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <IntSelector>(testingTarget, "Should return IntSelector instance.");

            try
            {
                var result = testingTarget.Clone();
                tlog.Debug(tag, "result : " + result);
            }
            catch (Exception)
            {
                //  System.InvalidCastException : Unable to cast object
                //  of type 'Tizen.NUI.BaseComponents.Selector`1[Tizen.NUI.Int]'
                //  to type 'Tizen.NUI.Components.IntSelector'

                // To fix

                tlog.Debug(tag, $"IntSelectorClone END (OK)");
                Assert.Pass("Passed!");
            }
        }
        public void Should_Use_Custom_Boundaries_for_Integer_Value_Injection()
        {
            //Create an instance of our test class
            var testInstance = new IntegerTestClass();

            var intMax = 10;
            var intMin = 1;

            //Create an instance of our IntSelector and set some custom bounds
            var selector =
                new IntSelector().SetMax(() => Faker.Generators.Numbers.Int(intMax, intMax))
                .SetMin(() => Faker.Generators.Numbers.Int(intMin, intMin));

            //Iterate over the test object's properties
            foreach (var property in testInstance.GetType().GetProperties())
            {
                Assert.IsTrue(selector.CanBind(property),
                              string.Format("should have been able to bind to property {0}", property.Name));

                //Inject the value into this property on our test instance class
                selector.Generate(testInstance, property);

                //Get the value out of the property
                var fieldValue = (int)property.GetValue(testInstance, null);
                Assert.IsNotNull(fieldValue);
                Assert.AreNotEqual(fieldValue, default(int));
                Assert.IsTrue(fieldValue <= intMax && fieldValue >= intMin, "Custom range should have worked");
            }
        }
Example #4
0
 public void ElementAttach()
 {
     trackSelector?.RemoveFromHierarchy();
     Element.Add(trackSelector = new IntSelector(this, "Track"));
 }