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); }
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); }
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); }
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); }
public void WhenGuidPoidThenApplyGuidOptimized() { var orm = new ObjectRelationalMapper(); orm.GetPersistentIdStrategy(typeof(EntityGuid).GetProperty("Id")).Strategy.Should().Be.EqualTo(PoIdStrategy.GuidOptimized); }
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); }