2016-03-22 23:02:25 +03:00
|
|
|
using System;
|
|
|
|
using NUnit.Framework;
|
2016-11-09 11:23:52 +03:00
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Globalization;
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
|
|
namespace Xamarin.Forms.Core.UnitTests
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
[TestFixture]
|
|
|
|
public class PickerTests : BaseTestFixture
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
class PickerTestsContextFixture
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
public class PickerTestsNestedClass
|
|
|
|
{
|
|
|
|
public string Nested { get; set; }
|
|
|
|
}
|
2016-11-09 11:23:52 +03:00
|
|
|
|
2016-11-09 17:15:12 +03:00
|
|
|
public PickerTestsNestedClass Nested { get; set; }
|
2016-11-09 11:23:52 +03:00
|
|
|
|
2016-11-09 17:15:12 +03:00
|
|
|
public string DisplayName { get; set; }
|
2016-11-09 11:23:52 +03:00
|
|
|
|
2016-11-09 17:15:12 +03:00
|
|
|
public string ComplexName { get; set; }
|
2016-11-09 11:23:52 +03:00
|
|
|
|
2016-11-09 17:15:12 +03:00
|
|
|
public PickerTestsContextFixture(string displayName, string complexName)
|
|
|
|
{
|
|
|
|
DisplayName = displayName;
|
|
|
|
ComplexName = complexName;
|
|
|
|
}
|
2016-11-09 11:23:52 +03:00
|
|
|
|
2016-11-09 17:15:12 +03:00
|
|
|
public PickerTestsContextFixture()
|
|
|
|
{
|
|
|
|
}
|
2016-11-09 11:23:52 +03:00
|
|
|
}
|
|
|
|
|
2016-11-09 17:15:12 +03:00
|
|
|
class PickerTestsBindingContext
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
public ObservableCollection<object> Items { get; set; }
|
|
|
|
|
|
|
|
public object SelectedItem { get; set; }
|
2016-11-09 11:23:52 +03:00
|
|
|
}
|
|
|
|
|
2016-11-09 17:15:12 +03:00
|
|
|
class PickerTestValueConverter : IValueConverter
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
public bool ConvertCalled { get; private set; }
|
|
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
{
|
|
|
|
ConvertCalled = true;
|
|
|
|
var cf = (PickerTestsContextFixture)value;
|
|
|
|
return cf.DisplayName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
2016-11-09 11:23:52 +03:00
|
|
|
}
|
|
|
|
|
2016-03-22 23:02:25 +03:00
|
|
|
[Test]
|
|
|
|
public void TestSetSelectedIndexOnNullRows()
|
|
|
|
{
|
2016-11-09 11:23:52 +03:00
|
|
|
var picker = new Picker();
|
2016-03-22 23:02:25 +03:00
|
|
|
|
2016-11-09 11:23:52 +03:00
|
|
|
Assert.IsEmpty(picker.Items);
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
|
|
picker.SelectedIndex = 2;
|
|
|
|
|
2016-11-09 11:23:52 +03:00
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSelectedIndexInRange()
|
|
|
|
{
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
Items = { "John", "Paul", "George", "Ringo" },
|
|
|
|
SelectedIndex = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
Assert.AreEqual(2, picker.SelectedIndex);
|
|
|
|
|
|
|
|
picker.SelectedIndex = 42;
|
|
|
|
Assert.AreEqual(3, picker.SelectedIndex);
|
|
|
|
|
|
|
|
picker.SelectedIndex = -1;
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
|
|
|
|
|
|
|
picker.SelectedIndex = -42;
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
2016-03-22 23:02:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2016-11-09 11:23:52 +03:00
|
|
|
public void TestSelectedIndexInRangeDefaultSelectedIndex()
|
2016-03-22 23:02:25 +03:00
|
|
|
{
|
2016-11-09 11:23:52 +03:00
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
Items = { "John", "Paul", "George", "Ringo" }
|
|
|
|
};
|
|
|
|
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
|
|
|
|
|
|
|
picker.SelectedIndex = -5;
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
|
|
picker.SelectedIndex = 2;
|
2016-11-09 11:23:52 +03:00
|
|
|
Assert.AreEqual(2, picker.SelectedIndex);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
|
|
picker.SelectedIndex = 42;
|
2016-11-09 11:23:52 +03:00
|
|
|
Assert.AreEqual(3, picker.SelectedIndex);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
|
|
picker.SelectedIndex = -1;
|
2016-11-09 11:23:52 +03:00
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
|
|
picker.SelectedIndex = -42;
|
2016-11-09 11:23:52 +03:00
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
2016-03-22 23:02:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSelectedIndexChangedOnCollectionShrink()
|
|
|
|
{
|
|
|
|
var picker = new Picker { Items = { "John", "Paul", "George", "Ringo" }, SelectedIndex = 3 };
|
|
|
|
|
2016-11-09 11:23:52 +03:00
|
|
|
Assert.AreEqual(3, picker.SelectedIndex);
|
|
|
|
|
|
|
|
picker.Items.RemoveAt(3);
|
|
|
|
picker.Items.RemoveAt(2);
|
|
|
|
|
|
|
|
Assert.AreEqual(1, picker.SelectedIndex);
|
|
|
|
|
|
|
|
picker.Items.Clear();
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSelectedIndexOutOfRangeUpdatesSelectedItem()
|
|
|
|
{
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
ItemsSource = new ObservableCollection<string>
|
|
|
|
{
|
|
|
|
"Monkey",
|
|
|
|
"Banana",
|
|
|
|
"Lemon"
|
|
|
|
},
|
|
|
|
SelectedIndex = 0
|
|
|
|
};
|
|
|
|
Assert.AreEqual("Monkey", picker.SelectedItem);
|
|
|
|
picker.SelectedIndex = 42;
|
|
|
|
Assert.AreEqual("Lemon", picker.SelectedItem);
|
|
|
|
picker.SelectedIndex = -42;
|
|
|
|
Assert.IsNull(picker.SelectedItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestUnsubscribeINotifyCollectionChanged()
|
|
|
|
{
|
|
|
|
var list = new ObservableCollection<string>();
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
ItemsSource = list
|
|
|
|
};
|
|
|
|
Assert.AreEqual(0, picker.Items.Count);
|
|
|
|
var newList = new ObservableCollection<string>();
|
|
|
|
picker.ItemsSource = newList;
|
|
|
|
list.Add("item");
|
|
|
|
Assert.AreEqual(0, picker.Items.Count);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestEmptyCollectionResetItems()
|
|
|
|
{
|
|
|
|
var list = new ObservableCollection<string>
|
|
|
|
{
|
|
|
|
"John",
|
|
|
|
"George",
|
|
|
|
"Ringo"
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
ItemsSource = list
|
|
|
|
};
|
|
|
|
Assert.AreEqual(3, picker.Items.Count);
|
|
|
|
picker.ItemsSource = new ObservableCollection<string>();
|
|
|
|
Assert.AreEqual(0, picker.Items.Count);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSetItemsSourceProperty()
|
|
|
|
{
|
|
|
|
var items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
new { Name = "John" },
|
|
|
|
"Paul",
|
|
|
|
"Ringo",
|
|
|
|
0,
|
|
|
|
new DateTime(1970, 1, 1),
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("Name"),
|
2016-11-09 11:23:52 +03:00
|
|
|
ItemsSource = items
|
|
|
|
};
|
|
|
|
Assert.AreEqual(5, picker.Items.Count);
|
|
|
|
Assert.AreEqual("John", picker.Items[0]);
|
2016-11-09 17:15:12 +03:00
|
|
|
Assert.AreEqual(null, picker.Items[3]);
|
2016-11-09 11:23:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestDisplayConverter()
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
var obj = new PickerTestsContextFixture("John", "John Doe");
|
2016-11-09 11:23:52 +03:00
|
|
|
var converter = new PickerTestValueConverter();
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding (Binding.SelfPath, converter:converter),
|
2016-11-09 11:23:52 +03:00
|
|
|
ItemsSource = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
obj
|
|
|
|
}
|
|
|
|
};
|
|
|
|
Assert.IsTrue(converter.ConvertCalled);
|
|
|
|
Assert.AreEqual("John", picker.Items[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestItemsSourceCollectionChangedAppend()
|
|
|
|
{
|
|
|
|
var items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
new { Name = "John" },
|
|
|
|
"Paul",
|
|
|
|
"Ringo"
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("Name"),
|
2016-11-09 11:23:52 +03:00
|
|
|
ItemsSource = items,
|
|
|
|
SelectedIndex = 0
|
|
|
|
};
|
|
|
|
Assert.AreEqual(3, picker.Items.Count);
|
|
|
|
Assert.AreEqual("John", picker.Items[0]);
|
|
|
|
items.Add(new { Name = "George" });
|
|
|
|
Assert.AreEqual(4, picker.Items.Count);
|
|
|
|
Assert.AreEqual("George", picker.Items[picker.Items.Count - 1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestItemsSourceCollectionChangedClear()
|
|
|
|
{
|
|
|
|
var items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
new { Name = "John" },
|
|
|
|
"Paul",
|
|
|
|
"Ringo"
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("Name"),
|
2016-11-09 11:23:52 +03:00
|
|
|
ItemsSource = items,
|
|
|
|
SelectedIndex = 0
|
|
|
|
};
|
|
|
|
Assert.AreEqual(3, picker.Items.Count);
|
|
|
|
items.Clear();
|
|
|
|
Assert.AreEqual(0, picker.Items.Count);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestItemsSourceCollectionChangedInsert()
|
|
|
|
{
|
|
|
|
var items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
new { Name = "John" },
|
|
|
|
"Paul",
|
|
|
|
"Ringo"
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("Name"),
|
2016-11-09 11:23:52 +03:00
|
|
|
ItemsSource = items,
|
|
|
|
SelectedIndex = 0
|
|
|
|
};
|
|
|
|
Assert.AreEqual(3, picker.Items.Count);
|
|
|
|
Assert.AreEqual("John", picker.Items[0]);
|
|
|
|
items.Insert(1, new { Name = "George" });
|
|
|
|
Assert.AreEqual(4, picker.Items.Count);
|
|
|
|
Assert.AreEqual("George", picker.Items[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestItemsSourceCollectionChangedReAssign()
|
|
|
|
{
|
|
|
|
var items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
new { Name = "John" },
|
|
|
|
"Paul",
|
|
|
|
"Ringo"
|
|
|
|
};
|
|
|
|
var bindingContext = new { Items = items };
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("Name"),
|
2016-11-09 11:23:52 +03:00
|
|
|
BindingContext = bindingContext
|
|
|
|
};
|
|
|
|
picker.SetBinding(Picker.ItemsSourceProperty, "Items");
|
|
|
|
Assert.AreEqual(3, picker.Items.Count);
|
|
|
|
items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
"Peach",
|
|
|
|
"Orange"
|
|
|
|
};
|
|
|
|
picker.BindingContext = new { Items = items };
|
2016-11-09 17:15:12 +03:00
|
|
|
picker.ItemDisplayBinding = null;
|
2016-11-09 11:23:52 +03:00
|
|
|
Assert.AreEqual(2, picker.Items.Count);
|
|
|
|
Assert.AreEqual("Peach", picker.Items[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestItemsSourceCollectionChangedRemove()
|
|
|
|
{
|
|
|
|
var items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
new { Name = "John" },
|
2016-11-09 17:15:12 +03:00
|
|
|
new { Name = "Paul" },
|
|
|
|
new { Name = "Ringo"},
|
2016-11-09 11:23:52 +03:00
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("Name"),
|
2016-11-09 11:23:52 +03:00
|
|
|
ItemsSource = items,
|
|
|
|
SelectedIndex = 0
|
|
|
|
};
|
|
|
|
Assert.AreEqual(3, picker.Items.Count);
|
|
|
|
Assert.AreEqual("John", picker.Items[0]);
|
|
|
|
items.RemoveAt(1);
|
|
|
|
Assert.AreEqual(2, picker.Items.Count);
|
|
|
|
Assert.AreEqual("Ringo", picker.Items[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestItemsSourceCollectionOfStrings()
|
|
|
|
{
|
|
|
|
var items = new ObservableCollection<string>
|
|
|
|
{
|
|
|
|
"John",
|
|
|
|
"Paul",
|
|
|
|
"Ringo"
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
ItemsSource = items,
|
|
|
|
SelectedIndex = 0
|
|
|
|
};
|
|
|
|
Assert.AreEqual(3, picker.Items.Count);
|
|
|
|
Assert.AreEqual("John", picker.Items[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestSelectedItemDefault()
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
var bindingContext = new PickerTestsBindingContext
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
|
|
|
Items = new ObservableCollection<object>
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
new PickerTestsContextFixture("John", "John")
|
2016-11-09 11:23:52 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
BindingContext = bindingContext
|
|
|
|
};
|
|
|
|
picker.SetBinding(Picker.ItemsSourceProperty, "Items");
|
|
|
|
picker.SetBinding(Picker.SelectedItemProperty, "SelectedItem");
|
|
|
|
Assert.AreEqual(1, picker.Items.Count);
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
|
|
|
Assert.AreEqual(bindingContext.SelectedItem, picker.SelectedItem);
|
|
|
|
}
|
2016-03-22 23:02:25 +03:00
|
|
|
|
2016-11-09 17:15:12 +03:00
|
|
|
[Test]
|
|
|
|
public void ThrowsWhenModifyingItemsIfItemsSourceIsSet()
|
|
|
|
{
|
|
|
|
var picker = new Picker {
|
|
|
|
ItemsSource = new System.Collections.Generic.List<object> ()
|
|
|
|
};
|
|
|
|
Assert.Throws<InvalidOperationException>(() => picker.Items.Add("foo"));
|
|
|
|
}
|
|
|
|
|
2016-11-09 11:23:52 +03:00
|
|
|
[Test]
|
|
|
|
public void TestNestedDisplayMemberPathExpression()
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
var obj = new PickerTestsContextFixture
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
Nested = new PickerTestsContextFixture.PickerTestsNestedClass
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
|
|
|
Nested = "NestedProperty"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("Nested.Nested"),
|
2016-11-09 11:23:52 +03:00
|
|
|
ItemsSource = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
obj
|
|
|
|
},
|
|
|
|
SelectedIndex = 0
|
|
|
|
};
|
|
|
|
Assert.AreEqual("NestedProperty", picker.Items[0]);
|
|
|
|
}
|
2016-03-22 23:02:25 +03:00
|
|
|
|
2016-11-09 11:23:52 +03:00
|
|
|
[Test]
|
|
|
|
public void TestItemsSourceEnums()
|
|
|
|
{
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
ItemsSource = new ObservableCollection<TextAlignment>
|
|
|
|
{
|
|
|
|
TextAlignment.Start,
|
|
|
|
TextAlignment.Center,
|
|
|
|
TextAlignment.End
|
|
|
|
},
|
|
|
|
SelectedIndex = 0
|
|
|
|
};
|
|
|
|
Assert.AreEqual("Start", picker.Items[0]);
|
|
|
|
}
|
2016-03-22 23:02:25 +03:00
|
|
|
|
2016-11-09 11:23:52 +03:00
|
|
|
[Test]
|
|
|
|
public void TestSelectedItemSet()
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
var obj = new PickerTestsContextFixture("John", "John");
|
|
|
|
var bindingContext = new PickerTestsBindingContext
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
|
|
|
Items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
obj
|
|
|
|
},
|
|
|
|
SelectedItem = obj
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
BindingContext = bindingContext,
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("DisplayName"),
|
2016-11-09 11:23:52 +03:00
|
|
|
};
|
|
|
|
picker.SetBinding(Picker.ItemsSourceProperty, "Items");
|
|
|
|
picker.SetBinding(Picker.SelectedItemProperty, "SelectedItem");
|
|
|
|
Assert.AreEqual(1, picker.Items.Count);
|
|
|
|
Assert.AreEqual(0, picker.SelectedIndex);
|
|
|
|
Assert.AreEqual(obj, picker.SelectedItem);
|
|
|
|
}
|
2016-03-22 23:02:25 +03:00
|
|
|
|
2016-11-09 11:23:52 +03:00
|
|
|
[Test]
|
|
|
|
public void TestSelectedItemChangeSelectedIndex()
|
|
|
|
{
|
2016-11-09 17:15:12 +03:00
|
|
|
var obj = new PickerTestsContextFixture("John", "John");
|
|
|
|
var bindingContext = new PickerTestsBindingContext
|
2016-11-09 11:23:52 +03:00
|
|
|
{
|
|
|
|
Items = new ObservableCollection<object>
|
|
|
|
{
|
|
|
|
obj
|
|
|
|
},
|
|
|
|
};
|
|
|
|
var picker = new Picker
|
|
|
|
{
|
|
|
|
BindingContext = bindingContext,
|
2016-11-09 17:15:12 +03:00
|
|
|
ItemDisplayBinding = new Binding("DisplayName"),
|
2016-11-09 11:23:52 +03:00
|
|
|
};
|
|
|
|
picker.SetBinding(Picker.ItemsSourceProperty, "Items");
|
|
|
|
picker.SetBinding(Picker.SelectedItemProperty, "SelectedItem");
|
|
|
|
Assert.AreEqual(1, picker.Items.Count);
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
|
|
|
Assert.AreEqual(null, picker.SelectedItem);
|
|
|
|
picker.SelectedItem = obj;
|
|
|
|
Assert.AreEqual(0, picker.SelectedIndex);
|
|
|
|
Assert.AreEqual(obj, picker.SelectedItem);
|
|
|
|
picker.SelectedIndex = -1;
|
|
|
|
Assert.AreEqual(-1, picker.SelectedIndex);
|
|
|
|
Assert.AreEqual(null, picker.SelectedItem);
|
2016-03-22 23:02:25 +03:00
|
|
|
}
|
2016-11-09 11:23:52 +03:00
|
|
|
}
|
|
|
|
}
|