コード例 #1
0
        public void PrivateFieldNegative()
        {
            RecipeDetail detail1 = new RecipeDetail(true, "Toffee");
            detail1.Ingredient = "Crunchy Chocolate";

            RecipeDetail detail2 = new RecipeDetail(true, "Crunchy Frogs");
            detail2.Ingredient = "Crunchy Chocolate";

            _compare.Config.ComparePrivateFields = true;
            Assert.IsFalse(_compare.Compare(detail1, detail2).AreEqual);
            _compare.Config.ComparePrivateFields = false;
        }
コード例 #2
0
        public void PrivatePropertyPositive()
        {
            RecipeDetail detail1 = new RecipeDetail(true, "Toffee");
            detail1.Ingredient = "Crunchy Chocolate";

            RecipeDetail detail2 = new RecipeDetail(true, "Toffee");
            detail2.Ingredient = "Crunchy Chocolate";

            _compare.Config.ComparePrivateProperties = true;
            Assert.IsTrue(_compare.Compare(detail1, detail2).AreEqual);
            _compare.Config.ComparePrivateProperties = false;
        }
コード例 #3
0
        public void IgnoreReadOnlyPositive()
        {
            RecipeDetail detail1 = new RecipeDetail(true, "Toffee");
            detail1.Ingredient = "Crunchy Chocolate";

            RecipeDetail detail2 = new RecipeDetail(false, "Toffee");
            detail2.Ingredient = "Crunchy Chocolate";

            _compare.Config.CompareReadOnly = false;
            Assert.IsTrue(_compare.Compare(detail1, detail2).AreEqual);
            _compare.Config.CompareReadOnly = true;
        }
コード例 #4
0
        public void IgnoreReadOnlyNegative()
        {
            RecipeDetail detail1 = new RecipeDetail(true, "Toffee");
            detail1.Ingredient = "Crunchy Chocolate";

            RecipeDetail detail2 = new RecipeDetail(false, "Toffee");
            detail2.Ingredient = "Crunchy Chocolate";

            Assert.IsFalse(_compare.Compare(detail1, detail2).AreEqual);
        }
コード例 #5
0
        public void IgnoreObjectTypesNegative()
        {
            RecipeDetail detail1 = new RecipeDetail(true, "Toffee");
            detail1.Ingredient = "Crunchy Chocolate";

            IndianRecipeDetail detail2 = new IndianRecipeDetail(true, "Toffee");
            detail2.Ingredient = "Curry sauce";

            _compare.Config.IgnoreObjectTypes = true;
            var result = _compare.Compare(detail1, detail2);

            Console.WriteLine(result.DifferencesString);
            Assert.IsFalse(result.AreEqual, result.DifferencesString);
            _compare.Config.IgnoreObjectTypes = false;
        }