Ejemplo n.º 1
0
 private static void AssertValidState <T, U, V>(ISelectionPageModel <T, U, V> selection)
     where U : IPageModel
     where V : ISelectablePageModel <U>, ITextValuedPageModel <T>
 {
     if (selection.SelectedItem == null)
     {
         AssertNothingSelected(selection);
     }
     else
     {
         AssertSingleSelection(selection);
         Assert.IsTrue(selection.SelectedItem.IsSelected);
     }
 }
Ejemplo n.º 2
0
        private static void ISelectionPageModel_StandardTests <T, U, V>(ISelectionPageModel <T, U, V> selection)
            where U : IPageModel
            where V : ISelectablePageModel <U>, ITextValuedPageModel <T>
        {
            if (!selection.Items.Any())
            {
                Assert.Inconclusive();
            }

            AssertValidState(selection);

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

            foreach (var selectionItem in selection.Items)
            {
                selectionItem.SetSelected(true);
                AssertValidState(selection);
            }
        }
Ejemplo n.º 3
0
 private static void AssertSingleSelection <T, U, V>(ISelectionPageModel <T, U, V> selection)
     where U : IPageModel
     where V : ISelectablePageModel <U>, ITextValuedPageModel <T>
 {
     Assert.IsTrue(selection.Items.SkipWhile(x => !x.IsSelected).Skip(1).All(x => !x.IsSelected));
 }
Ejemplo n.º 4
0
 private static void AssertNothingSelected <T, U, V>(ISelectionPageModel <T, U, V> selection)
     where U : IPageModel
     where V : ISelectablePageModel <U>, ITextValuedPageModel <T>
 {
     Assert.IsTrue(selection.Items.All(x => !x.IsSelected));
 }