You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Converters;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Windows {
|
||||
|
||||
[TestFixture]
|
||||
public class Int32RectValueSerializerTest
|
||||
{
|
||||
[Test]
|
||||
public void CanConvertFromString ()
|
||||
{
|
||||
var serializer = new Int32RectValueSerializer ();
|
||||
Assert.IsTrue (serializer.CanConvertFromString ("", null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanConvertToString ()
|
||||
{
|
||||
var serializer = new Int32RectValueSerializer ();
|
||||
Assert.IsTrue (serializer.CanConvertToString (new Int32Rect (0, 0, 0, 0), null));
|
||||
Assert.IsFalse (serializer.CanConvertToString ("", null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConvertFromString ()
|
||||
{
|
||||
var serializer = new Int32RectValueSerializer ();
|
||||
object obj = serializer.ConvertFromString ("3,4,5,6", null);
|
||||
Assert.AreEqual (typeof (Int32Rect), obj.GetType ());
|
||||
Assert.AreEqual (new Int32Rect (3, 4, 5, 6), obj);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RoundTripConvert()
|
||||
{
|
||||
var serializer = new Int32RectValueSerializer ();
|
||||
var size = new Int32Rect (7, 8, 9, 10);
|
||||
var obj = serializer.ConvertFromString (serializer.ConvertToString (size, null), null);
|
||||
Assert.AreEqual (size, obj);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (FormatException))]
|
||||
public void ConvertFromStringShouldThrowExceptionWhenStringHasInvalidFormat ()
|
||||
{
|
||||
var serializer = new Int32RectValueSerializer ();
|
||||
serializer.ConvertFromString ("a,b,c,d", null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void ConvertFromStringShouldThrowExceptionWhenStringIsNull ()
|
||||
{
|
||||
var serializer = new Int32RectValueSerializer ();
|
||||
serializer.ConvertFromString (null, null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void ConvertToStringShouldThrowExceptionWhenInvalidType ()
|
||||
{
|
||||
var serializer = new Int32RectValueSerializer ();
|
||||
serializer.ConvertToString (10, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user