Beispiel #1
0
        public void OnlySharedRules()
        {
            UnitTestContext context = GetContext();

            ApplicationContext.GlobalContext.Clear();
            ApplicationContext.GlobalContext["Shared"] = 0;

            HasOnlyPerTypeRules root = new HasOnlyPerTypeRules();

            root.Validate();
            context.Assert.AreEqual(string.Empty, root.Test, "Test string should be empty");
            context.Assert.AreEqual(1, root.BrokenRulesCollection.Count, "Broken rule count should be 1 first");
            root.Test = "test";
            context.Assert.AreEqual("test", root.Test, "Test string should be 'test'");
            context.Assert.AreEqual(0, root.BrokenRulesCollection.Count, "Broken rule count should be 0");
            root.Test = "big test";
            context.Assert.AreEqual("big test", root.Test, "Test string should be 'big test'");
            context.Assert.AreEqual(1, root.BrokenRulesCollection.Count, "Broken rule count should be 1 last");
            context.Assert.Success();
            context.Complete();
        }
Beispiel #2
0
        public void OnlySharedRules()
        {
            IDataPortal <HasOnlyPerTypeRules> dataPortal = _testDIContext.CreateDataPortal <HasOnlyPerTypeRules>();

            UnitTestContext context = GetContext();

            TestResults.Reinitialise();
            TestResults.Add("Shared", "0");

            HasOnlyPerTypeRules root = dataPortal.Create();

            root.Validate();
            context.Assert.AreEqual(string.Empty, root.Test, "Test string should be empty");
            context.Assert.AreEqual(1, root.BrokenRulesCollection.Count, "Broken rule count should be 1 first");
            root.Test = "test";
            context.Assert.AreEqual("test", root.Test, "Test string should be 'test'");
            context.Assert.AreEqual(0, root.BrokenRulesCollection.Count, "Broken rule count should be 0");
            root.Test = "big test";
            context.Assert.AreEqual("big test", root.Test, "Test string should be 'big test'");
            context.Assert.AreEqual(1, root.BrokenRulesCollection.Count, "Broken rule count should be 1 last");
            context.Assert.Success();
            context.Complete();
        }