Esempio n. 1
0
 private static void AssertValidState <T, U, V>(INamedSelectionPageModel <T, U, V> selection)
     where U : IPageModel
     where V : INamedSelectionItemPageModel <T, U>
 {
     if (selection.SelectedItem == null)
     {
         AssertNothingSelected(selection);
     }
     else
     {
         AssertSingleSelection(selection);
         Assert.IsTrue(selection.SelectedItem.IsSelected);
     }
 }
Esempio n. 2
0
        private static void INamedSelectionPageModel_StandardTests <T, U, V>(INamedSelectionPageModel <T, U, V> selection)
            where U : IPageModel
            where V : INamedSelectionItemPageModel <T, U>
        {
            if (!selection.Items.Any())
            {
                Assert.Inconclusive();
            }

            if (selection.SelectedItem != null)
            {
                selection.SelectedItem.SetSelected(false);
                AssertValidState(selection);
            }

            foreach (var name in selection.Items.Select(x => x.Name))
            {
                selection.SetValueText(name);
                AssertValidState(selection);
                Assert.IsTrue(StringComparer.Ordinal.Equals(selection.SelectedItem.Name, name));
            }
        }
Esempio n. 3
0
 private static void AssertSingleSelection <T, U, V>(INamedSelectionPageModel <T, U, V> selection)
     where U : IPageModel
     where V : INamedSelectionItemPageModel <T, U>
 {
     Assert.IsTrue(selection.Items.SkipWhile(x => !x.IsSelected).Skip(1).All(x => !x.IsSelected));
 }
Esempio n. 4
0
 private static void AssertNothingSelected <T, U, V>(INamedSelectionPageModel <T, U, V> selection)
     where U : IPageModel
     where V : INamedSelectionItemPageModel <T, U>
 {
     Assert.IsTrue(selection.Items.All(x => !x.IsSelected));
 }