public void That_NullableBoolAndPassEqualToNullableBool_TransformToAssertNotEqual(bool?value, bool?expected)
        {
            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var assertAreEqualValidator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetAreNotEqualAction(A <Expression> ._, A <Expression> ._, A <string> ._)).AddAssertValidation(assertAreEqualValidator);

            Expect.That(() => value != expected);

            assertAreEqualValidator.WasAssertCalledWithArguments(expected, value);
        }
Exemple #2
0
        public void That_StringEndssWithCalled_StringAssertStartsWithUsed()
        {
            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var validator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetStringEndsWith(A <Expression> ._, A <Expression> ._, A <string> ._)).AddAssertValidation(validator);

            Expect.That(() => "1234".EndsWith("2"));

            validator.WasAssertCalledWithArguments("2", "1234");
        }
        public void That_CheckIfArrayConatainsElement_CollectionAssertContainsCalled()
        {
            var collection = new[] { 1, 2, 3, 4, 5 };

            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var validator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetCollectionContains(A <Expression> ._, A <Expression> ._, A <string> ._)).AddAssertValidation(validator);

            Expect.That(() => collection.Contains(7));

            validator.WasAssertCalledWithArguments(collection, 7);
        }
        public void That_PassLeftValueNotEqualToTrue_AssertFalseIsCalled()
        {
            var value = DummyCreator.GetTrueValue();

            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var validator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetIsFalseAction(A <Expression> ._, A <string> ._)).AddAssertValidation(validator);

            Expect.That(() => value != true);

            validator.WasAssertCalledWithArguments(value);
        }
        public void That_NullableBoolAndPassEqualToFalseValue_AreEqualCalled()
        {
            var value = (bool?)DummyCreator.GetTrueValue();

            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var validator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetAreEqualAction(A <Expression> ._, A <Expression> ._, A <string> ._)).AddAssertValidation(validator);

            Expect.That(() => value == false);

            validator.WasAssertCalledWithArguments <bool?, bool?>(false, value);
        }
Exemple #6
0
        public void That_UseIsToCheckType_AssertIsInstaceOfCalled()
        {
            var val = DummyCreator.GetDummy();

            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var validator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetIsInstanceOf(A <Type> ._, A <Expression> ._, A <string> ._)).AddAssertValidation(validator);

            Expect.That(() => val is string);

            validator.WasAssertCalledWithArguments(typeof(string), val);
        }
Exemple #7
0
        public void That_CompareValueNotEqualToNullReversed_AssertIsNullCalled()
        {
            object val = null;

            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var validator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetIsNotNullAction(A <Expression> ._, A <string> ._)).AddAssertValidation(validator);

            Expect.That(() => null != val);

            validator.WasAssertCalledWithArguments(val);
        }
Exemple #8
0
        public void That_NullableBoolAndPassEqualToNull_AssertIsNullCalled()
        {
            var value = (bool?)null;

            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var validator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetIsNullAction(A <Expression> ._, A <string> ._)).AddAssertValidation(validator);

            Expect.That(() => value == null);

            validator.WasAssertCalledWithArguments(value);
        }
        public void That_CheckIfArrayEqualsToArray_CollectionEqualsCalled()
        {
            var collection1 = new [] { 1, 2, 3, 4, 5 };
            var collection2 = new[] { 1, 2, 3, 4, 6 };

            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var validator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetCollectionEquals(A <Expression> ._, A <Expression> ._, A <string> ._)).AddAssertValidation(validator);

            Expect.That(() => collection1 == collection2);

            validator.WasAssertCalledWithArguments(collection2, collection1);
        }
        public void That_PassTwoDoubleValuesWithNotEqualSign_TransformToAssertNotEqual()
        {
            var value    = DummyCreator.GetDouble();
            var expected = value;

            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var assertAreEqualValidator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetAreNotEqualAction(A <Expression> ._, A <Expression> ._, A <string> ._)).AddAssertValidation(assertAreEqualValidator);

            Expect.That(() => value != expected);

            assertAreEqualValidator.WasAssertCalledWithArguments(expected, value);
        }
        public void That_HaveOneEqualityAndOneBooleanInsideAssertBlock_BothConditionsAreTested()
        {
            var fakeBuilder = AssertBuilderFactoryForTests.FakeAssertBuilder();

            var assertIsTrueValidor     = new CallValidator();
            var assertAreEqualValidator = new CallValidator();

            A.CallTo(() => fakeBuilder.GetIsTrueAction(A <Expression> ._, A <string> ._)).AddAssertValidation(assertIsTrueValidor);
            A.CallTo(() => fakeBuilder.GetAreEqualAction(A <Expression> ._, A <Expression> ._, A <string> ._)).AddAssertValidation(assertAreEqualValidator);

            var obj1 = DummyCreator.GetReferenceObject1();
            var obj2 = DummyCreator.GetReferenceObject2();
            var b1   = DummyCreator.GetTrueBooleanValue();

            Expect.That(() => obj1 == obj2 && b1);

            assertIsTrueValidor.WasAssertCalledWithArguments(b1);
            assertAreEqualValidator.WasAssertCalledWithArguments(obj2, obj1);
        }