public WhenTheIdentifierPropertyIsInherited()
            {
                var settings = UnitTest.GetConventionMappingSettings(IdentifierStrategy.DbGenerated);

                var mappingConvention = new ConventionMappingConvention(settings);

                this.objectInfo = mappingConvention.CreateObjectInfo(typeof(CustomerEntity));
            }
            public void TheTableNameShouldBeUppercasedWithUnderscoresIfMultipleWords()
            {
                var mappingConvention = new ConventionMappingConvention(ConventionMappingSettings.UppercaseWithUnderscores);

                var creditCardObjectInfo = mappingConvention.CreateObjectInfo(typeof(CreditCard));

                Assert.Equal("CREDIT_CARDS", creditCardObjectInfo.TableInfo.Name);
            }
            public void AnArgumentNullExceptionIsThrown()
            {
                var mappingConvention = new ConventionMappingConvention(new ConventionMappingSettings());

                var exception = Assert.Throws <ArgumentNullException>(
                    () => mappingConvention.CreateObjectInfo(null));

                Assert.Equal("forType", exception.ParamName);
            }
            public WhenTheIdentifierStrategyIsSequence()
            {
                var settings = UnitTest.GetConventionMappingSettings(IdentifierStrategy.Sequence);

                settings.UsePluralClassNameForTableName = false;

                var mappingConvention = new ConventionMappingConvention(settings);

                this.objectInfo = mappingConvention.CreateObjectInfo(typeof(Customer));
            }
            public WhenTheClassIdentifierIsPrefixedWithTheClassName()
            {
                var mappingConvention = new ConventionMappingConvention(new ConventionMappingSettings
                {
                    ResolveIdentifierStrategy = (Type type) =>
                    {
                        return(IdentifierStrategy.Assigned);
                    },
                    UsePluralClassNameForTableName = false
                });

                this.objectInfo = mappingConvention.CreateObjectInfo(typeof(Invoice));
            }
            public WhenNotUsingDefaultSettings()
            {
                var settings = UnitTest.GetConventionMappingSettings(IdentifierStrategy.Assigned);

                settings.Ignore = (PropertyInfo propertyInfo) =>
                {
                    return(propertyInfo.Name == "Website");
                };
                settings.UsePluralClassNameForTableName = false;

                var mappingConvention = new ConventionMappingConvention(settings);

                this.objectInfo = mappingConvention.CreateObjectInfo(typeof(Customer));
            }
            public WhenUsingDefaultSettings()
            {
                var mappingConvention = new ConventionMappingConvention(ConventionMappingSettings.Default);

                this.objectInfo = mappingConvention.CreateObjectInfo(typeof(Customer));
            }
            public IgnoredProperties()
            {
                var mappingConvention = new ConventionMappingConvention(ConventionMappingSettings.Default);

                this.objectInfo = mappingConvention.CreateObjectInfo(typeof(Product));
            }
            public WhenUsingUppercaseWithUnderscores()
            {
                var mappingConvention = new ConventionMappingConvention(ConventionMappingSettings.UppercaseWithUnderscores);

                this.objectInfo = mappingConvention.CreateObjectInfo(typeof(Customer));
            }