Ejemplo n.º 1
0
        public void RoundTripConvert()
        {
            var serializer = new RectValueSerializer();
            var rect       = new Rect(1.234, 2.678, 3.123, 4.567);
            var obj        = serializer.ConvertFromString(serializer.ConvertToString(rect, null), null);

            Assert.AreEqual(rect, obj);
        }
Ejemplo n.º 2
0
        public void ConvertFromString()
        {
            var    serializer = new RectValueSerializer();
            object obj        = serializer.ConvertFromString("3.14,4.15,5.16,6.17", null);

            Assert.AreEqual(typeof(Rect), obj.GetType());
            Assert.AreEqual(new Rect(3.14, 4.15, 5.16, 6.17), obj);
        }
Ejemplo n.º 3
0
 public void ConvertToStringShouldThrowExceptionWhenHeightOrWidthIsNegative()
 {
     var serializer = new RectValueSerializer();
     var result     = serializer.ConvertFromString("1,2,-1,-2", null);
 }
Ejemplo n.º 4
0
        public void ConvertFromStringShouldThrowExceptionWhenStringIsNull()
        {
            var serializer = new RectValueSerializer();

            serializer.ConvertFromString(null, null);
        }
Ejemplo n.º 5
0
        public void ConvertFromStringShouldThrowExceptionWhenStringHasInvalidFormat()
        {
            var serializer = new RectValueSerializer();

            serializer.ConvertFromString("a,b,c,d", null);
        }