コード例 #1
0
 public void GetManifestRuleIdentifierShouldThrowIfNoMatchingMemberIsFound(RelativeToManifestRuleIdentifierConverter sut,
                                                                           [ManifestModel] ManifestValue value,
                                                                           [ManifestModel] ManifestValue parent,
                                                                           Type ruleType)
 {
     value.Parent = parent;
     Assert.That(() => sut.GetManifestRuleIdentifier(value, new RelativeRuleIdentifier(ruleType, "NoMember", ancestorLevels: 1)),
                 Throws.ArgumentException.And.Message.StartWith("The ManifestValue must have configuration for a member named \"NoMember\"."));
 }
コード例 #2
0
 public void GetManifestRuleIdentifierShouldThrowIfExcessAncestorLevelsAreSpecified(RelativeToManifestRuleIdentifierConverter sut,
                                                                                    [ManifestModel] ManifestValue value,
                                                                                    [ManifestModel] ManifestValue parent,
                                                                                    Type ruleType)
 {
     value.Parent = parent;
     Assert.That(() => sut.GetManifestRuleIdentifier(value, new RelativeRuleIdentifier(ruleType, ancestorLevels: 2)),
                 Throws.ArgumentException.And.Message.StartWith("The ManifestValue must have at least 2 level(s) of ancestors."));
 }
コード例 #3
0
        public void GetManifestRuleIdentifierShouldGetCorrectIdentifierForACousinRuleForAMemberWithARuleName(RelativeToManifestRuleIdentifierConverter sut,
                                                                                                             [ManifestModel] ManifestValue value,
                                                                                                             [ManifestModel] ManifestValue parent,
                                                                                                             [ManifestModel] ManifestValue cousin,
                                                                                                             Type ruleType,
                                                                                                             string memberName,
                                                                                                             string ruleName)
        {
            // A "Cousin" rule requires us to descend to the parent manifest
            // value, then enter a child based upon a member name
            value.Parent = parent;
            parent.Children.Add(cousin);
            cousin.MemberName = memberName;
            var expected = new ManifestRuleIdentifier(cousin, ruleType, ruleName);
            var result   = sut.GetManifestRuleIdentifier(value, new RelativeRuleIdentifier(ruleType, memberName, ruleName, 1));

            Assert.That(result, Is.EqualTo(expected));
        }
コード例 #4
0
        public void GetManifestRuleIdentifierShouldGetCorrectIdentifierForAParentRuleWithAName(RelativeToManifestRuleIdentifierConverter sut,
                                                                                               [ManifestModel] ManifestValue value,
                                                                                               [ManifestModel] ManifestValue parent,
                                                                                               Type ruleType,
                                                                                               string ruleName)
        {
            value.Parent = parent;
            var expected = new ManifestRuleIdentifier(parent, ruleType, ruleName);
            var result   = sut.GetManifestRuleIdentifier(value, new RelativeRuleIdentifier(ruleType, ancestorLevels: 1, ruleName: ruleName));

            Assert.That(result, Is.EqualTo(expected));
        }
コード例 #5
0
        public void GetManifestRuleIdentifierShouldGetCorrectIdentifierForASiblingRuleWitAName(RelativeToManifestRuleIdentifierConverter sut,
                                                                                               [ManifestModel] ManifestValue value,
                                                                                               Type ruleType,
                                                                                               string ruleName)
        {
            var expected = new ManifestRuleIdentifier(value, ruleType, ruleName);
            var result   = sut.GetManifestRuleIdentifier(value, new RelativeRuleIdentifier(ruleType, ruleName: ruleName));

            Assert.That(result, Is.EqualTo(expected));
        }