public void WhenDefineWithoutPropertiesThenNothingHappen()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <MyClass>();
            ActionAssert.NotThrow(() => orm.NaturalId <MyClass>());
        }
예제 #2
0
        public void SchemaExport()
        {
            Configuration conf = ConfigureNHibernate();

            conf.AddDeserializedMapping(GetMapping(), "Animals_Domain");
            SchemaMetadataUpdater.QuoteTableAndColumns(conf);
            ActionAssert.NotThrow(() => new SchemaExport(conf).Create(false, true));
            new SchemaExport(conf).Drop(false, true);
        }
        public void WhenSetAccessorByTypeThenCheckCompatibility()
        {
            var member  = typeof(MyClass).GetProperty("ReadOnly");
            var mapping = new HbmVersion();
            var mapper  = new VersionMapper(member, mapping);

            ActionAssert.Throws <ArgumentOutOfRangeException>(() => mapper.Access(typeof(object)));
            ActionAssert.NotThrow(() => mapper.Access(typeof(FieldAccessor)));
            mapping.access.Should().Be.EqualTo(typeof(FieldAccessor).AssemblyQualifiedName);
        }
        public void AllowMoreThanOne()
        {
            var e = new WithRegEx {
                Value = "aaa"
            };
            var ca = new ClassValidator(typeof(WithRegEx));
            var iv = ca.GetInvalidValues(e).ToArray();

            ActionAssert.NotThrow(() => iv = ca.GetInvalidValues(e).ToArray());
        }
        public void IdMetaTypeShouldBeImmutableAfterAddMetaValues()
        {
            var hbmMapping = new HbmMapping();
            var hbmAny     = new HbmAny();
            var mapper     = new AnyMapper(null, typeof(int), hbmAny, hbmMapping);

            mapper.MetaValue('A', typeof(MyReferenceClass));
            ActionAssert.NotThrow(() => mapper.IdType(NHibernateUtil.Int32));
            ActionAssert.NotThrow(mapper.IdType <int>);
            ActionAssert.Throws <ArgumentException>(mapper.IdType <string>);
            ActionAssert.Throws <ArgumentException>(() => mapper.IdType(NHibernateUtil.String));
        }
예제 #6
0
        public void DelegatedValidate_WithoutMessageNotThrow()
        {
            var configure = new FluentConfiguration();

            configure.Register(new[] { typeof(RangeDefWithoutCustomMessage) })
            .SetDefaultValidatorMode(ValidatorMode.UseExternal);
            var ve = new ValidatorEngine();

            ve.Configure(configure);
            ActionAssert.NotThrow(() => ve.IsValid(new Range {
                Start = 1, End = 4
            }));
        }
 public void CtorProtection()
 {
     ActionAssert.Throws <ArgumentNullException>(() => new PropertyPath(null, null));
     ActionAssert.NotThrow(() => new PropertyPath(null, myClassComponent1));
     ActionAssert.Throws <ArgumentNullException>(() => new PropertyPath(new PropertyPath(null, myClassComponent1), null));
 }
        public void WhenApplierIsNullThenNotThrow()
        {
            IPatternsAppliersHolder source = new EmptyPatternsAppliersHolder();

            ActionAssert.NotThrow(() => source.UnionWith <PropertyPath, IPropertyMapper>(null));
        }
예제 #9
0
        public void ShouldWorkWithEnum()
        {
            var v = new ValidationDef <KnownRules>();

            ActionAssert.NotThrow(() => v.Define(x => x.Enum));
        }
        public void WhenNullNothingHappen()
        {
            List <IPatternValueGetter <string, string> > patterns = null;

            ActionAssert.NotThrow(() => patterns.GetValueOfFirstMatch("pp"));
        }