Ejemplo n.º 1
0
        public void Vector4TypeConverterConvertFromInvariantString()
        {
            tlog.Debug(tag, $"Vector4TypeConverterConvertFromInvariantString START");

            var testingTarget = new Vector4TypeConverterImpl();

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

            // length is 4
            var result = testingTarget.ConvertFromInvariantString("100, 50, 30, 10");

            tlog.Debug(tag, "ConvertFromInvariantString : " + result);

            // length is 3
            result = testingTarget.ConvertFromInvariantString("100, 50, 30");
            tlog.Debug(tag, "ConvertFromInvariantString : " + result);

            // length is 2
            result = testingTarget.ConvertFromInvariantString("100, 50");
            tlog.Debug(tag, "ConvertFromInvariantString : " + result);

            // length is 1
            result = testingTarget.ConvertFromInvariantString("100");
            tlog.Debug(tag, "ConvertFromInvariantString : " + result);
            Assert.Throws <InvalidOperationException>(() => testingTarget.ConvertFromInvariantString("100, 50, 30, 10, 0.3f"));
            tlog.Debug(tag, $"Vector4TypeConverterConvertFromInvariantString END");
        }
Ejemplo n.º 2
0
        public void Vector4TypeConverterConvertToString()
        {
            tlog.Debug(tag, $"Vector4TypeConverterConvertToString START");

            var testingTarget = new Vector4TypeConverterImpl();

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

            // null
            var result = testingTarget.ConvertToString(0.3f);

            tlog.Debug(tag, "ConvertToString : " + result);

            using (Vector4 vec = new Vector4(0.1f, 0.3f, 0.5f, 0.0f))
            {
                result = testingTarget.ConvertToString(vec);
                tlog.Debug(tag, "ConvertToString : " + result);
            }

            tlog.Debug(tag, $"Vector4TypeConverterConvertToString END");
        }