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

            var testingTarget = new RelativeVector4TypeConverterImpl();

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4TypeConverter.");
            Assert.IsInstanceOf <RelativeVector4TypeConverter>(testingTarget, "Should return RelativeVector4TypeConverter 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, $"RelativeVector4TypeConverterConvertFromInvariantString END");
        }
Exemplo n.º 2
0
        public void RelativeVector4TypeConverterConvertToString()
        {
            tlog.Debug(tag, $"RelativeVector4TypeConverterConvertToString START");

            var testingTarget = new RelativeVector4TypeConverterImpl();

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

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

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

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

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