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();
44 Assert.AreEqual(1, root.BrokenRulesCollection.ErrorCount,
"Only one rule should be broken");
45 Assert.AreEqual(
"Test required", root.BrokenRulesCollection.GetFirstBrokenRule(
"Test").Description,
"'Test required' should be broken");
55 root.Test =
"some data";
56 Assert.AreEqual(1, root.BrokenRulesCollection.ErrorCount,
"Only one rule should be broken with data");
57 Assert.AreEqual(
"Always error", root.BrokenRulesCollection.GetFirstBrokenRule(
"Test").Description,
"'Always fails' should be broken");
59 Assert.AreEqual(1, root.BrokenRulesCollection.ErrorCount,
"Only one rule should be broken when empty");
60 Assert.AreEqual(
"Test required", root.BrokenRulesCollection.GetFirstBrokenRule(
"Test").Description,
"'Test required' should be broken");
70 Assert.AreEqual(1, root.BrokenRulesCollection.ErrorCount,
"Only one rule should be broken");
71 Assert.AreEqual(
"Test required", root.BrokenRulesCollection.GetFirstBrokenRule(
"Test").Description,
"'Test required' should be broken");
75 Assert.AreEqual(2, root.BrokenRulesCollection.ErrorCount,
"Two rules should be broken after checkrules");
76 root.Test =
"some data";
77 Assert.AreEqual(1, root.BrokenRulesCollection.ErrorCount,
"One rule should be broken with data");
78 Assert.AreEqual(
"Always error", root.BrokenRulesCollection.GetFirstBrokenRule(
"Test").Description,
"'Always fails' should be broken");
80 Assert.AreEqual(2, root.BrokenRulesCollection.ErrorCount,
"Two rules should be broken when empty");
static void ClassInitialize(TestContext testContext)
void ShortCircuitOnPropertySet()
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...