9using System.Collections.Generic;
16using TestClass = NUnit.Framework.TestFixtureAttribute;
17using TestInitialize = NUnit.Framework.SetUpAttribute;
18using TestCleanup = NUnit.Framework.TearDownAttribute;
19using TestMethod = NUnit.Framework.TestAttribute;
21using Microsoft.VisualStudio.TestTools.UnitTesting;
34 _testDIContext = TestDIContextFactory.CreateDefaultContext();
45 Assert.AreEqual(3, root.BrokenRulesCollection.Count,
"3 rules should be broken (total)");
47 Assert.IsFalse(root.IsValid,
"Object should not be valid");
49 Assert.AreEqual(1, root.BrokenRulesCollection.ErrorCount,
"Only one rule should be broken");
50 Assert.AreEqual(
"Always error", root.BrokenRulesCollection.GetFirstBrokenRule(
"Test").Description,
"'Always error' should be broken (GetFirstBrokenRule)");
51 Assert.AreEqual(
"Always error", root.BrokenRulesCollection.GetFirstMessage(
"Test",
Csla.
Rules.RuleSeverity.Error).Description,
"'Always error' should be broken");
53 Assert.AreEqual(1, root.BrokenRulesCollection.WarningCount,
"Only one warning should be broken");
54 Assert.AreEqual(
"Always warns", root.BrokenRulesCollection.GetFirstMessage(
"Test",
Csla.
Rules.RuleSeverity.Warning).Description,
"'Always warns' should be broken");
56 Assert.AreEqual(1, root.BrokenRulesCollection.InformationCount,
"Only one info should be broken");
57 Assert.AreEqual(
"Always info", root.BrokenRulesCollection.GetFirstMessage(
"Test",
Csla.
Rules.RuleSeverity.Information).Description,
"'Always info' should be broken");
67 Assert.AreEqual(2, root.BrokenRulesCollection.Count,
"2 rules should be broken (total)");
69 Assert.IsTrue(root.IsValid,
"Object should be valid");
70 Assert.AreEqual(0, root.BrokenRulesCollection.ErrorCount,
"No rules (errors) should be broken");
72 Assert.AreEqual(1, root.BrokenRulesCollection.WarningCount,
"Only one warning should be broken");
73 Assert.AreEqual(
"Always warns", root.BrokenRulesCollection.GetFirstMessage(
"Test",
Csla.
Rules.RuleSeverity.Warning).Description,
"'Always warns' should be broken");
75 Assert.AreEqual(1, root.BrokenRulesCollection.InformationCount,
"Only one info should be broken");
76 Assert.AreEqual(
"Always info", root.BrokenRulesCollection.GetFirstMessage(
"Test",
Csla.
Rules.RuleSeverity.Information).Description,
"'Always info' should be broken");
static void ClassInitialize(TestContext testContext)
Type to carry context information for DI in unit tests
Interface defining the members of the data portal type.
object Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...