maui-linux/Xamarin.Forms.Core.UnitTests/PickerTests.cs

479 строки
11 KiB
C#
Исходник Обычный вид История

2016-03-22 23:02:25 +03:00
using System;
using NUnit.Framework;
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
{
[TestFixture]
public class PickerTests : BaseTestFixture
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
{
class PickerTestsContextFixture
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
{
public class PickerTestsNestedClass
{
public string Nested { get; set; }
}
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
public PickerTestsNestedClass Nested { get; set; }
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
public string DisplayName { get; set; }
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
public string ComplexName { get; set; }
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
public PickerTestsContextFixture(string displayName, string complexName)
{
DisplayName = displayName;
ComplexName = complexName;
}
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
public PickerTestsContextFixture()
{
}
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
}
class PickerTestsBindingContext
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
{
public ObservableCollection<object> Items { get; set; }
public object SelectedItem { get; set; }
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
}
class PickerTestValueConverter : IValueConverter
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +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();
}
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
}
2016-03-22 23:02:25 +03:00
[Test]
public void TestSetSelectedIndexOnNullRows()
{
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
var picker = new Picker();
2016-03-22 23:02:25 +03:00
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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;
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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]
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
public void TestSelectedIndexInRangeDefaultSelectedIndex()
2016-03-22 23:02:25 +03:00
{
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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;
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
Assert.AreEqual(2, picker.SelectedIndex);
2016-03-22 23:02:25 +03:00
picker.SelectedIndex = 42;
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
Assert.AreEqual(3, picker.SelectedIndex);
2016-03-22 23:02:25 +03:00
picker.SelectedIndex = -1;
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
Assert.AreEqual(-1, picker.SelectedIndex);
2016-03-22 23:02:25 +03:00
picker.SelectedIndex = -42;
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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 };
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
{
ItemDisplayBinding = new Binding("Name"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
ItemsSource = items
};
Assert.AreEqual(5, picker.Items.Count);
Assert.AreEqual("John", picker.Items[0]);
Assert.AreEqual(null, picker.Items[3]);
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
}
[Test]
public void TestDisplayConverter()
{
var obj = new PickerTestsContextFixture("John", "John Doe");
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
var converter = new PickerTestValueConverter();
var picker = new Picker
{
ItemDisplayBinding = new Binding (Binding.SelfPath, converter:converter),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
{
ItemDisplayBinding = new Binding("Name"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
{
ItemDisplayBinding = new Binding("Name"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
{
ItemDisplayBinding = new Binding("Name"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
{
ItemDisplayBinding = new Binding("Name"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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 };
picker.ItemDisplayBinding = null;
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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" },
new { Name = "Paul" },
new { Name = "Ringo"},
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
};
var picker = new Picker
{
ItemDisplayBinding = new Binding("Name"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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()
{
var bindingContext = new PickerTestsBindingContext
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
{
Items = new ObservableCollection<object>
{
new PickerTestsContextFixture("John", "John")
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
[Test]
public void ThrowsWhenModifyingItemsIfItemsSourceIsSet()
{
var picker = new Picker {
ItemsSource = new System.Collections.Generic.List<object> ()
};
Assert.Throws<InvalidOperationException>(() => picker.Items.Add("foo"));
}
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
[Test]
public void TestNestedDisplayMemberPathExpression()
{
var obj = new PickerTestsContextFixture
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
{
Nested = new PickerTestsContextFixture.PickerTestsNestedClass
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
{
Nested = "NestedProperty"
}
};
var picker = new Picker
{
ItemDisplayBinding = new Binding("Nested.Nested"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
[Test]
public void TestSelectedItemSet()
{
var obj = new PickerTestsContextFixture("John", "John");
var bindingContext = new PickerTestsBindingContext
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
{
Items = new ObservableCollection<object>
{
obj
},
SelectedItem = obj
};
var picker = new Picker
{
BindingContext = bindingContext,
ItemDisplayBinding = new Binding("DisplayName"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
[Test]
public void TestSelectedItemChangeSelectedIndex()
{
var obj = new PickerTestsContextFixture("John", "John");
var bindingContext = new PickerTestsBindingContext
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
{
Items = new ObservableCollection<object>
{
obj
},
};
var picker = new Picker
{
BindingContext = bindingContext,
ItemDisplayBinding = new Binding("DisplayName"),
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
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
}
Squashed commit of the following: commit 8d784ec7459335ca33003844a793c3dd266c5861 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:30:25 2016 +0200 Added DisplayConverter property of type IValueConverter to perform conversion from object to string commit afb606f05c16b14e24785fad017540dd83dbf373 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Tue Aug 23 00:07:55 2016 +0200 Use IsValueType commit 4742c22ed33309f40a55c536b161292eb5db40f8 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:58:40 2016 +0200 Fixed bug with nested property expression commit 70a121e6172a61dbcf8835137bf58bd972cf2065 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Fri Aug 19 18:43:14 2016 +0200 Added more tests commit 49c7876bda4185c699f5fd9b3a66763efca9623c Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 18 13:28:36 2016 +0200 Siimplified setting SelectedItem. Added property to provide full control over how to display the objects by DisplayFunc. Added tests commit 5c1d5e149dc21c58cebf7cdbc6677d1ccec04ed4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:15:36 2016 +0200 Trying to fix formatting with tabs instead of spaces commit d64663ce3ef6b223a04d477274e93ec87bd38ff4 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 17:10:39 2016 +0200 Formatting. Handle Reset,Move,Replace collection changed action equal by re binding Items collection commit 8d4641810cb3b11fb6b47f8215bb5950a9641ba2 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:33:03 2016 +0200 Removed inline documentation. Fixed formatting commit 28010a1b31da02879fd2d549d5b02458766544d5 Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 16:29:37 2016 +0200 Removed SelectedValue since SelectedIndex and SelectedItem make it redundant commit ac9d65816fe6db7b467c304e6dc3168a84d3166b Author: Joakim Carselind <joakim.carselind@cub.se> Date: Thu Aug 11 14:51:20 2016 +0200 Initial attempt on bindable picker
2016-11-09 11:23:52 +03:00
}
}