예제 #1
0
        public void MapGeneratorUsingGuidComb()
        {
            Mock <IDomainInspector> orm = GetBaseMock <EntityInt>();

            IPersistentIdStrategy idStrategy = new PoidStrategyStub {
                Strategy = PoIdStrategy.GuidOptimized
            };

            orm.Setup(m => m.GetPersistentIdStrategy(It.Is <MemberInfo>(mi => mi.Name == "Id"))).Returns(idStrategy);

            var mapper  = new Mapper(orm.Object);
            var mapping = mapper.CompileMappingFor(new[] { typeof(EntityInt) });

            HbmClass rc = mapping.RootClasses.Single();

            [email protected]().Be.EqualTo("guid.comb");
        }
예제 #2
0
        public void MapGeneratorUsingDomainInspectorInfo()
        {
            Mock <IDomainInspector> orm = GetBaseMock <EntityInt>();

            IPersistentIdStrategy idStrategy = new PoidStrategyStub {
                Strategy = PoIdStrategy.HighLow, Params = new { max_low = 100, column = "NewHigh" }
            };

            orm.Setup(m => m.GetPersistentIdStrategy(It.Is <MemberInfo>(mi => mi.Name == "Id"))).Returns(idStrategy);

            var mapper  = new Mapper(orm.Object);
            var mapping = mapper.CompileMappingFor(new[] { typeof(EntityInt) });

            mapping.RootClasses.Should().Have.Count.EqualTo(1);
            HbmClass rc           = mapping.RootClasses.Single();
            var      hbmGenerator = rc.Id.generator;

            [email protected]().Be.EqualTo("hilo");
            hbmGenerator.param.Select(p => p.name).Should().Have.SameValuesAs("max_low", "column");
            hbmGenerator.param.Select(p => p.GetText()).Should().Have.SameValuesAs("100", "NewHigh");
        }