public void FormatUnexpectedDataType_MyClass_Assert()
        {
            BearingFormatInfo info = new BearingFormatInfo();

            string result = string.Format(info, "{0:XYZ}", new MyClass());

            Assert.AreEqual(typeof(MyClass).FullName, result);
        }
        public void FormatUnexpectedDataType_POCO_Assert()
        {
            int value = 12;
            BearingFormatInfo info = new BearingFormatInfo();

            string result = string.Format(info, "{0:XYZ}", value);

            Assert.AreEqual("XYZ", result);
        }
Example #3
0
        public void ToBearing_Provider_Format_Assert()
        {
            var                degrees  = 41.79620158;
            string             format   = "dms5";
            IFormatProvider    provider = new BearingFormatInfo();
            DegreeMinuteSecond subject  = new DegreeMinuteSecond(degrees);

            string result = subject.ToBearing(provider, format);

            Assert.AreEqual("041° 47' 46.32569''", result);
        }
Example #4
0
        public void ToBearing_Provider_Assert()
        {
            var degrees = 41.79620158;
            BearingFormatInfo provider = new BearingFormatInfo();

            provider.Separator = "-";
            DegreeMinuteSecond subject = new DegreeMinuteSecond(degrees);

            string result = subject.ToBearing(provider);

            Assert.AreEqual("042°", result);
        }