public void WhenExplicitIdentityForSpecificClassThenApplyOnlyInThatClassOnly()
        {
            var customPoidPattern = new Mock<IPatternValueGetter<MemberInfo, IPersistentIdStrategy>>();
            var identityResult = new Mock<IPersistentIdStrategy>();
            identityResult.Setup(r => r.Strategy).Returns(PoIdStrategy.Identity);
            var specificId = typeof(AnotherWithInt).GetProperty("Id");
            customPoidPattern.Setup(p => p.Match(It.Is<MemberInfo>(mi => mi == specificId))).Returns(true);
            customPoidPattern.Setup(p => p.Get(It.Is<MemberInfo>(mi => mi == specificId))).Returns(identityResult.Object);
            var orm = new ObjectRelationalMapper();
            orm.Patterns.PoidStrategies.Add(customPoidPattern.Object);

            orm.GetPersistentIdStrategy(typeof(EntityInt).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.HighLow);
            orm.GetPersistentIdStrategy(specificId).Strategy.Should().Be.EqualTo(PoIdStrategy.Identity);
        }
Пример #2
0
        public void WhenGuidPoidExplicitGuidThenApplyGuid()
        {
            var orm = new ObjectRelationalMapper();

            orm.Patterns.PoidStrategies.Add(new GuidPoidPattern());
            orm.GetPersistentIdStrategy(typeof(EntityGuid).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.Guid);
        }
Пример #3
0
        public void WhenIntPoidExplicitNativeThenApplyNative()
        {
            var orm = new ObjectRelationalMapper();

            orm.Patterns.PoidStrategies.Add(new NativePoidPattern());
            orm.GetPersistentIdStrategy(typeof(EntityInt).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.Native);
        }
Пример #4
0
        public void WhenExplicitIdentityForSpecificClassThenApplyOnlyInThatClassOnly()
        {
            var customPoidPattern = new Mock <IPatternValueGetter <MemberInfo, IPersistentIdStrategy> >();
            var identityResult    = new Mock <IPersistentIdStrategy>();

            identityResult.Setup(r => r.Strategy).Returns(PoIdStrategy.Identity);
            var specificId = typeof(AnotherWithInt).GetProperty("Id");

            customPoidPattern.Setup(p => p.Match(It.Is <MemberInfo>(mi => mi == specificId))).Returns(true);
            customPoidPattern.Setup(p => p.Get(It.Is <MemberInfo>(mi => mi == specificId))).Returns(identityResult.Object);
            var orm = new ObjectRelationalMapper();

            orm.Patterns.PoidStrategies.Add(customPoidPattern.Object);

            orm.GetPersistentIdStrategy(typeof(EntityInt).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.HighLow);
            orm.GetPersistentIdStrategy(specificId).Strategy.Should().Be.EqualTo(PoIdStrategy.Identity);
        }
Пример #5
0
        public void WhenGuidPoidThenApplyGuidOptimized()
        {
            var orm = new ObjectRelationalMapper();

            orm.GetPersistentIdStrategy(typeof(EntityGuid).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.GuidOptimized);
        }
Пример #6
0
        public void WhenIntPoidThenApplyHilo()
        {
            var orm = new ObjectRelationalMapper();

            orm.GetPersistentIdStrategy(typeof(EntityInt).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.HighLow);
        }
 public void WhenIntPoidThenApplyHilo()
 {
     var orm = new ObjectRelationalMapper();
     orm.GetPersistentIdStrategy(typeof (EntityInt).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.HighLow);
 }
 public void WhenIntPoidExplicitSequenceThenApplySequence()
 {
     var orm = new ObjectRelationalMapper();
     orm.Patterns.PoidStrategies.Add(new SequencePoidPattern());
     orm.GetPersistentIdStrategy(typeof(EntityInt).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.Sequence);
 }
 public void WhenGuidPoidThenApplyGuidOptimized()
 {
     var orm = new ObjectRelationalMapper();
     orm.GetPersistentIdStrategy(typeof(EntityGuid).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.GuidOptimized);
 }
 public void WhenGuidPoidExplicitGuidThenApplyGuid()
 {
     var orm = new ObjectRelationalMapper();
     orm.Patterns.PoidStrategies.Add(new GuidPoidPattern());
     orm.GetPersistentIdStrategy(typeof(EntityGuid).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.Guid);
 }