예제 #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);
     }
 }
예제 #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));
            }
        }
예제 #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));
 }
예제 #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));
 }