コード例 #1
0
        public void FormatUnexpectedDataType_MyClass_Assert()
        {
            LongitudeFormatInfo info = new LongitudeFormatInfo();

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

            Assert.AreEqual(typeof(MyClass).FullName, result);
        }
コード例 #2
0
        public void FormatUnexpectedDataType_POCO_Assert()
        {
            int value = 12;
            LongitudeFormatInfo info = new LongitudeFormatInfo();

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

            Assert.AreEqual("XYZ", result);
        }
コード例 #3
0
        public void ToLongitude_Provider_Format_Assert()
        {
            var                degrees  = 41.79620158;
            string             format   = "dms5";
            IFormatProvider    provider = new LongitudeFormatInfo();
            DegreeMinuteSecond subject  = new DegreeMinuteSecond(degrees);

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

            Assert.AreEqual("041° 47' 46.32569'' E", result);
        }
コード例 #4
0
        public void ToLongitude_Provider_Assert()
        {
            var degrees = 41.79620158;
            LongitudeFormatInfo provider = new LongitudeFormatInfo();

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

            string result = subject.ToLongitude(provider);

            Assert.AreEqual("041°-47'-46''-E", result);
        }