Esempio n. 1
0
        public void WhenTheNameNoMatchThenThrows()
        {
            var applier = new SubclassDiscriminatorValueAsEnumValueApplier <Item, EntitiesTypesFixed>();
            var mapper  = new Mock <ISubclassAttributesMapper>();

            applier.Executing(a => a.Apply(typeof(Gallery), mapper.Object)).Throws <ArgumentException>();
        }
Esempio n. 2
0
        public void AlwaysMatch()
        {
            // the pattern can match only when called for subclass
            var applier = new SubclassDiscriminatorValueAsEnumValueApplier <Item, EntitiesTypes>();

            applier.Match(typeof(Item)).Should().Be.True();
        }
        public void WhenTheNameNoMatchThenThrows()
        {
            var applier = new SubclassDiscriminatorValueAsEnumValueApplier<Item, EntitiesTypesFixed>();
            var mapper = new Mock<ISubclassAttributesMapper>();

            applier.Executing(a => a.Apply(typeof(Gallery), mapper.Object)).Throws<ArgumentException>();
        }
Esempio n. 4
0
        public void WhenTheNameMatchThenApplyEnumValue()
        {
            var applier = new SubclassDiscriminatorValueAsEnumValueApplier <Item, EntitiesTypes>();
            var mapper  = new Mock <ISubclassAttributesMapper>();

            applier.Apply(typeof(Contribute), mapper.Object);

            mapper.Verify(cm => cm.DiscriminatorValue(It.Is <int>(n => ((int)EntitiesTypes.Contribute).Equals(n))));
        }
        public void WhenTheNameMatchThenApplyEnumValue()
        {
            var applier = new SubclassDiscriminatorValueAsEnumValueApplier<Item, EntitiesTypes>();
            var mapper = new Mock<ISubclassAttributesMapper>();

            applier.Apply(typeof(Contribute), mapper.Object);

            mapper.Verify(cm => cm.DiscriminatorValue(It.Is<int>(n => ((int)EntitiesTypes.Contribute).Equals(n))));
        }
Esempio n. 6
0
        public void WhenOutsideTheDefinedHierarchyThenNoMatch()
        {
            var applier = new SubclassDiscriminatorValueAsEnumValueApplier <Item, EntitiesTypes>();

            applier.Match(typeof(SomethingOutOfHierarchy)).Should().Be.False();
        }
 public void WhenOutsideTheDefinedHierarchyThenNoMatch()
 {
     var applier = new SubclassDiscriminatorValueAsEnumValueApplier<Item, EntitiesTypes>();
     applier.Match(typeof(SomethingOutOfHierarchy)).Should().Be.False();
 }
 public void AlwaysMatch()
 {
     // the pattern can match only when called for subclass
     var applier = new SubclassDiscriminatorValueAsEnumValueApplier<Item, EntitiesTypes>();
     applier.Match(typeof(Item)).Should().Be.True();
 }