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;
33 foreach (var item
in root.Rules)
36 Assert.AreEqual(
"csla.test.validationrules.myrule", desc.RuleTypeName,
"Wrong rule type name");
44 Assert.AreEqual(
"type", uri.RuleTypeName,
"Rule type");
45 Assert.AreEqual(
"property", uri.PropertyName,
"Property name");
48 Assert.AreEqual(
"type", uri.RuleTypeName,
"Rule type");
49 Assert.AreEqual(
"property", uri.PropertyName,
"Property name");
56 Assert.AreEqual(
"type", uri.RuleTypeName,
"Rule type");
57 Assert.AreEqual(
"property", uri.PropertyName,
"Property name");
64 Assert.AreEqual(
"a-----25-c3-84", uri.RuleTypeName,
"Rule type");
65 Assert.AreEqual(
"P-----25-C3-84", uri.PropertyName,
"Property name");
71 var hostName =
"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij";
74 Assert.AreEqual(hostName.Replace(
"/",
""), uri.RuleTypeName,
"Rule type");
75 Assert.AreEqual(
"property", uri.PropertyName,
"Property name");
82 Assert.AreEqual(1, uri.Arguments.Count,
"Count should be 1");
83 Assert.AreEqual(
"v1", uri.Arguments[
"p1"],
"Value shoudl be v1");
86 Assert.AreEqual(2, uri.Arguments.Count,
"Count should be 2");
87 Assert.AreEqual(
"v1", uri.Arguments[
"p1"],
"Value shoudl be v1");
88 Assert.AreEqual(
"v2", uri.Arguments[
"p2"],
"Value shoudl be v2");
98 get {
return GetProperty<string>(NameProperty); }
99 set { SetProperty<string>(NameProperty, value); }
104 BusinessRules.AddRule(
new MyRule { PrimaryProperty = NameProperty });
109 get {
return this.BusinessRules.GetRuleDescriptions(); }
115 protected override void Execute(Rules.IRuleContext context)
117 base.Execute(context);
This is the base class from which most business objects will be derived.
Maintains metadata about a property.
Parses a rule:// URI to provide easy access to the parts of the URI.
override void Execute(Rules.IRuleContext context)
void SpecialCharacterParsing()
override void AddBusinessRules()
@ Serializable
Prevents updating or inserting until the transaction is complete.