Jo Shields 3c1f479b9d Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
2015-04-07 09:35:12 +01:00

59 lines
1.5 KiB
C#

//
// System.ComponentModel.TypeConverter test cases
//
// Authors:
// Jonathan Pryor <jpryor@novell.com>
//
// (c) 2009 Novell, Inc. (http://novell.com)
//
using System;
using System.ComponentModel;
using NUnit.Framework;
namespace MonoTests.System.ComponentModel
{
[TestFixture]
public class ListChangedEventArgsTests
{
[Test]
public void Ctor_ListChangedType_NewIndex()
{
ListChangedEventArgs e = new ListChangedEventArgs (ListChangedType.ItemAdded, 0);
Assert.AreEqual (ListChangedType.ItemAdded, e.ListChangedType);
Assert.AreEqual (0, e.NewIndex);
Assert.AreEqual (-1, e.OldIndex);
}
[Test]
public void Ctor_ListChangedType_NewIndex_OldIndex()
{
ListChangedEventArgs e = new ListChangedEventArgs (ListChangedType.ItemMoved, 1, 2);
Assert.AreEqual (ListChangedType.ItemMoved, e.ListChangedType);
Assert.AreEqual (1, e.NewIndex);
Assert.AreEqual (2, e.OldIndex);
}
[Test]
public void Ctor_ListChangedType_PropDesc()
{
PropertyDescriptor p = null;
ListChangedEventArgs e = new ListChangedEventArgs (ListChangedType.ItemMoved, p);
Assert.AreEqual (ListChangedType.ItemMoved, e.ListChangedType);
Assert.AreEqual (0, e.NewIndex);
Assert.AreEqual (0, e.OldIndex);
}
[Test]
public void Ctor_ListChangedType_NewIndex_PropDesc()
{
PropertyDescriptor p = null;
ListChangedEventArgs e = new ListChangedEventArgs (ListChangedType.ItemMoved, 2, p);
Assert.AreEqual (ListChangedType.ItemMoved, e.ListChangedType);
Assert.AreEqual (2, e.NewIndex);
Assert.AreEqual (2, e.OldIndex);
}
}
}