public bool Equals(SelectionIncludeCondition visibility)
 {
     if (Equals(visibility.Skip, visibility.Include))
     {
         if (Parent is null)
         {
             return(visibility.Parent is null);
         }
         else
         {
             return(visibility.Parent is { } && Parent.Equals(visibility.Parent));
Пример #2
0
        public void Include_True_Is_Visible_True()
        {
            // arrange
            var variableValues = new Mock <IVariableValueCollection>();
            var visibility     = new SelectionIncludeCondition(include: new BooleanValueNode(true));

            // act
            var visible = visibility.IsTrue(variableValues.Object);

            // assert
            Assert.True(visible);
        }
Пример #3
0
        public void Include_Var_True_Is_Visible_True()
        {
            // arrange
            var variableValues = new Mock <IVariableValueCollection>();

            variableValues.Setup(t => t.GetVariable <bool>("b")).Returns(true);
            var visibility = new SelectionIncludeCondition(include: new VariableNode("b"));

            // act
            var visible = visibility.IsTrue(variableValues.Object);

            // assert
            Assert.True(visible);
        }
Пример #4
0
        public void Equals_Include_Variable_A_vs_Variable_A()
        {
            // arrange
            var a = new SelectionIncludeCondition(
                include: new VariableNode("a"));

            var b = new SelectionIncludeCondition(
                include: new VariableNode("a"));

            // act
            var equals = a.Equals(b);

            // assert
            Assert.True(equals);
        }
Пример #5
0
        public void Equals_Include_True_vs_Variable()
        {
            // arrange
            var a = new SelectionIncludeCondition(
                include: new BooleanValueNode(true));

            var b = new SelectionIncludeCondition(
                include: new VariableNode("b"));

            // act
            var equals = a.Equals(b);

            // assert
            Assert.False(equals);
        }
Пример #6
0
        public void Parent_Visible_False()
        {
            // arrange
            var variableValues = new Mock <IVariableValueCollection>();

            var parent = new SelectionIncludeCondition(
                include: new BooleanValueNode(false));

            var visibility = new SelectionIncludeCondition(
                include: new BooleanValueNode(true),
                parent: parent);

            // act
            var visible = visibility.IsTrue(variableValues.Object);

            // assert
            Assert.False(visible);
        }