Пример #1
0
        public void Size2DConstructor()
        {
            tlog.Debug(tag, $"Size2DConstructorWithInteger START");

            var testingTarget = new Size2D();

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should return Size2D instance.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DConstructorWithInteger END (OK)");
        }
Пример #2
0
        public void Size2DConstructorWithInteger()
        {
            tlog.Debug(tag, $"Size2DConstructorWithInteger START");

            var testingTarget = new Size2D(100, 100);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should return Size2D instance.");

            Assert.AreEqual(100, testingTarget.Height, "The Height property of position is not correct here.");
            Assert.AreEqual(100, testingTarget.Width, "The Width property of position is not correct here.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DConstructorWithInteger END (OK)");
        }
Пример #3
0
        public void Size2DGetValueBySubscriptIndex()
        {
            tlog.Debug(tag, $"Size2DGetValueBySubscriptIndex START");

            var testingTarget = new Size2D(100, 300);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            Assert.AreEqual(100, testingTarget[0], "The value of index[0] is not correct!");
            Assert.AreEqual(300, testingTarget[1], "The value of index[1] is not correct!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DGetValueBySubscriptIndex END (OK)");
        }
Пример #4
0
        public void NUIApplicationConstructorWithSizePositionAndThemeOptions()
        {
            tlog.Debug(tag, $"NUIApplicationConstructorWithSizePositionAndThemeOptions START");

            Size2D     windowSize     = new Size2D(100, 50);
            Position2D windowPosition = new Position2D(20, 30);
            var        testingTarget  = new NUIApplication(windowSize, windowPosition, NUIApplication.ThemeOptions.PlatformThemeEnabled);

            Assert.IsNotNull(testingTarget, "Should be not null.");
            Assert.IsInstanceOf <NUIApplication>(testingTarget, "Should be an instance of NUIApplication type.");

            windowSize.Dispose();
            windowPosition.Dispose();
            tlog.Debug(tag, $"NUIApplicationConstructorWithSizePositionAndThemeOptions END (OK)");
        }
Пример #5
0
        public void Size2DGetHashCode()
        {
            tlog.Debug(tag, $"Size2DGetHashCode START");

            var testingTarget = new Size2D(10, 20);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            var result = testingTarget.GetHashCode();

            Assert.IsTrue(result >= Int32.MinValue && result <= Int32.MaxValue, "The value of hash is out of Integer range");

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DGetHashCode END (OK)");
        }
Пример #6
0
        public void Size2DImplicitToSize2D()
        {
            tlog.Debug(tag, $"Size2DImplicitToSize2D START");

            Size2D testingTarget = null;

            using (Vector2 vector = new Vector2(10, 20))
            {
                testingTarget = vector;
                Assert.AreEqual(vector.X, testingTarget.Width, "The value of Width is not correct.");
                Assert.AreEqual(vector.Y, testingTarget.Height, "The value of Height is not correct.");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DImplicitToSize2D END (OK)");
        }
Пример #7
0
        public void NUIApplicationConstructorForImeWindow()
        {
            tlog.Debug(tag, $"NUIApplicationConstructorForImeWindow START");

            Size2D     windowSize     = new Size2D(100, 50);
            Position2D windowPosition = new Position2D(20, 30);
            var        testingTarget  = new NUIApplication("", NUIApplication.WindowMode.Opaque, windowSize, windowPosition, WindowType.Dialog);

            Assert.IsNotNull(testingTarget, "Should be not null.");
            Assert.IsInstanceOf <NUIApplication>(testingTarget, "Should be an instance of NUIApplication type.");

            windowSize.Dispose();
            windowPosition.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"NUIApplicationConstructorForImeWindow END (OK)");
        }
Пример #8
0
        public void Size2DWidth()
        {
            tlog.Debug(tag, $"Size2DWidth START");

            var testingTarget = new Size2D(100, 100);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            Assert.AreEqual(100, testingTarget.Width, "The Width should be 100.0f here!");

            testingTarget.Width = 200;
            Assert.AreEqual(200, testingTarget.Width, "The Width should be 200.0f here!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DWidth END (OK)");
        }
Пример #9
0
        public void Size2DDivisionByInteger()
        {
            tlog.Debug(tag, $"Size2DDivisionByInteger START");

            var testingTarget = new Size2D(4, 6);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            var result = testingTarget / 2;

            Assert.AreEqual(2, result.Width, "The Width value of the size is not correct!");
            Assert.AreEqual(3, result.Height, "The Height value of the size is not correct!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DDivisionByInteger END (OK)");
        }
Пример #10
0
        public void Size2DUnaryNegation()
        {
            tlog.Debug(tag, $"Size2DUnaryNegation START");

            var testingTarget = new Size2D(2, 3);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            var result = -testingTarget;

            Assert.AreEqual(-2, result.Width, "The Width value of the size is not correct!");
            Assert.AreEqual(-3, result.Height, "The Height value of the size is not correct!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DUnaryNegation END (OK)");
        }
Пример #11
0
        public void Size2DNotEqualTo()
        {
            tlog.Debug(tag, $"Size2DNotEqualTo START");

            var testingTarget = new Size2D(10, 20);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            using (Size2D size = new Size2D(1, 2))
            {
                Assert.IsTrue((testingTarget.NotEqualTo(size)), "Should be equal");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DNotEqualTo END (OK)");
        }
Пример #12
0
        public void KeyValueSize2DValue()
        {
            tlog.Debug(tag, $"KeyValueSize2DValue START");

            Size2D   b1 = new Size2D(0, 0);
            KeyValue a1 = new KeyValue
            {
                Size2DValue = b1
            };

            b1 = a1.Size2DValue;

            b1.Dispose();
            a1.Dispose();
            tlog.Debug(tag, $"KeyValueSize2DValue END (OK)");
            Assert.Pass("KeyValueSize2DValue");
        }
Пример #13
0
        public void Size2DEquals()
        {
            tlog.Debug(tag, $"Size2DEquals START");

            var testingTarget = new Size2D(1, 1);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            using (Size2D size = new Size2D(1, 1))
            {
                var result = testingTarget.Equals(size);
                Assert.IsTrue(result, "Should be true here!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DEquals END (OK)");
        }
Пример #14
0
        public void Size2DMultiplyBySize2D()
        {
            tlog.Debug(tag, $"Size2DMultiplyBySize2D START");

            var testingTarget = new Size2D(2, 3);

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            using (Size2D size = new Size2D(4, 6))
            {
                var result = testingTarget * size;
                Assert.AreEqual(8, result.Width, "The Width value of the size is not correct!");
                Assert.AreEqual(18, result.Height, "The Height value of the size is not correct!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"Size2DMultiplyBySize2D END (OK)");
        }
Пример #15
0
        public void Size2DDispose()
        {
            tlog.Debug(tag, $"Size2DDispose START");

            var testingTarget = new Size2D();

            Assert.IsNotNull(testingTarget, "Can't create success object Size2D");
            Assert.IsInstanceOf <Size2D>(testingTarget, "Should be an instance of Size2D type.");

            try
            {
                testingTarget.Dispose();
            }
            catch (Exception e)
            {
                Assert.Fail("Caught Exception" + e.ToString());
            }

            tlog.Debug(tag, $"Size2DDispose END (OK)");
        }
Пример #16
0
        public void PropertyValueGetSize2DValue()
        {
            tlog.Debug(tag, $"PropertyValueGetSize2DValue START");

            var testingTarget = new PropertyValue(new Size2D(1, 2));

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <PropertyValue>(testingTarget, "should be an Instance of PropertyValue class.");

            Size2D size   = new Size2D(3, 4);
            var    result = testingTarget.Get(size);

            Assert.IsTrue(result);

            Assert.AreEqual(1, size.Width, "Get function with Size2D parameter does not work, Size2D.Width is not right");
            Assert.AreEqual(2, size.Height, "Get function with Size2D parameter does not work, Size2D.Height is not right");

            size.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"PropertyValueGetSize2DValue END (OK)");
        }