public void ConvertFrom_TypeError()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();
            object o = null;

            AssertExtensions.Throws <ArgumentException>(null, () => o = cv.ConvertFrom(null, null, 59));
            Assert.Null(o);
        }
コード例 #2
0
        public void ConvertFrom_FormatError()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();
            object o = null;

            Assert.Throws <ArgumentException>(() => o = cv.ConvertFrom(null, null, "100.5"));
            Assert.Null(o);
        }
コード例 #3
0
        public void ConvertFrom_TypeError()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();
            object o;

            o = cv.ConvertFrom(null, null, 59);
            Assert.IsNull(o, "A1");
        }
コード例 #4
0
        public void ConvertFrom_FormatError()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();
            object o;

            o = cv.ConvertFrom(null, null, "100.5");
            Assert.IsNull(o, "A1");
        }
        public void CanConvertTo()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();

            Assert.True(cv.CanConvertTo(null, typeof(string)), "A1");
            Assert.False(cv.CanConvertTo(null, typeof(TimeSpan)), "A2");
            Assert.False(cv.CanConvertTo(null, typeof(int)), "A3");
            Assert.False(cv.CanConvertTo(null, typeof(object)), "A4");
        }
        public void ConvertTo_TypeError2()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();
            TimeSpan ts;

            ts = TimeSpan.FromSeconds(59);

            Assert.Equal("59", cv.ConvertTo(null, null, ts, typeof(int)));
            Assert.Equal("59", cv.ConvertTo(null, null, ts, null));
        }
        public void ConvertFrom()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();
            object o;

            o = cv.ConvertFrom(null, null, "59");
            Assert.Equal(typeof(TimeSpan), o.GetType());
            Assert.Equal("00:00:59", o.ToString());
            o = cv.ConvertFrom(null, null, "104");
            Assert.Equal("00:01:44", o.ToString());
        }
        public void ConvertTo()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();
            TimeSpan ts;

            ts = TimeSpan.FromSeconds(59);
            Assert.Equal("59", cv.ConvertTo(null, null, ts, typeof(string)));

            ts = TimeSpan.FromSeconds(144);
            Assert.Equal("144", cv.ConvertTo(null, null, ts, typeof(string)));

            ts = TimeSpan.FromMilliseconds(3900);
            Assert.Equal("3", cv.ConvertTo(null, null, ts, typeof(string)));
        }
        public void ConvertTo_TypeError1()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();

            AssertExtensions.Throws <ArgumentException>(null, () => cv.ConvertTo(null, null, 59, typeof(string)));
        }
        public void ConvertTo_NullError()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();

            Assert.Throws <NullReferenceException>(() => cv.ConvertTo(null, null, null, typeof(string)));
        }
コード例 #11
0
        public void ConvertTo_TypeError1()
        {
            TimeSpanSecondsConverter cv = new TimeSpanSecondsConverter();

            Assert.AreEqual("59", cv.ConvertTo(null, null, 59, typeof(string)), "A1");
        }