public void ShouldBeAbleToMapAPropertyuWithSpecficLength()
        {
            const int fieldLength = 200;

            //Arrange
            var context = new EmptyDbContext();
            var configuration = new EasyConfiguration(context);

            //Act
            configuration.Configure<PersonModel>()
                .Map(x => x.FirstName, length: fieldLength);

            //Assert
            var tableConfiguration = configuration.TableConfigurations.FindByType<PersonModel>();
            var fields = tableConfiguration.Fields;
            var fieldConfiguraton = fields.GetByProperty<PersonModel, String>(x => x.FirstName);

            Assert.Equal(fieldLength, fieldConfiguraton.Length);
        }
        public void ShouldBeAbleToMapAPropertyWithADefaultValue()
        {
            const string defaultValue = "Oliver";

            //Arrange
            var context = new EmptyDbContext();
            var configuration = new EasyConfiguration(context);

            //Act
            configuration.Configure<PersonModel>()
                .Map(x => x.FirstName, defaultValue: defaultValue);

            //Assert
            var tableConfiguration = configuration.TableConfigurations.FindByType<PersonModel>();
            var fields = tableConfiguration.Fields;
            var fieldConfiguraton = fields.GetByProperty<PersonModel, String>(x => x.FirstName);

            Assert.Equal(defaultValue, fieldConfiguraton.DefaultValue);
        }
        public void ShouldBeAbleToMapAProperty()
        {
            //Arrange
            var context = new EmptyDbContext();
            var configuration = new EasyConfiguration(context);
            var expectedType = new NVarCharFieldType();

            //Act
            configuration.Configure<PersonModel>()
                .Map(x => x.FirstName);

            //Assert
            var tableConfiguration = configuration.TableConfigurations.FindByType<PersonModel>();
            var fields = tableConfiguration.Fields;
            var fieldConfiguraton = fields.GetByProperty<PersonModel, String>(x => x.FirstName);

            Assert.Equal(1, fields.Count);
            Assert.NotNull(fieldConfiguraton);
            Assert.Equal("FirstName", fieldConfiguraton.FieldName);
            Assert.Null(fieldConfiguraton.DefaultValue);
            //FieldType validation
            Assert.Equal(expectedType.Name, fieldConfiguraton.FieldType.Name);
            Assert.Equal(expectedType.DefaultLength, fieldConfiguraton.FieldType.DefaultLength);
        }
        public void ShouldBeAbleToMapAPropertyWithCustomFieldName()
        {
            const string fieldName = "Fornavn";

            //Arrange
            var context = new EmptyDbContext();
            var configuration = new EasyConfiguration(context);

            //Act
            configuration.Configure<PersonModel>()
                .Map(x => x.FirstName, field: fieldName);

            //Assert
            var tableConfiguration = configuration.TableConfigurations.FindByType<PersonModel>();
            var fields = tableConfiguration.Fields;
            var fieldConfiguraton = fields.GetByProperty<PersonModel, String>(x => x.FirstName);

            Assert.Equal(fieldName, fieldConfiguraton.FieldName);
        }