public void Byte_should_add_column_to_table_model() { var column = new ColumnBuilder().Byte(); Assert.Equal(PrimitiveTypeKind.Byte, column.Type); Assert.Equal((byte)0, column.ClrDefaultValue); }
public void Guid_should_add_column_to_table_model() { var column = new ColumnBuilder().Guid(); Assert.Equal(PrimitiveTypeKind.Guid, column.Type); Assert.Equal(Guid.Empty, column.ClrDefaultValue); }
public void DateTime_should_add_column_to_table_model() { var column = new ColumnBuilder().DateTime(); Assert.Equal(PrimitiveTypeKind.DateTime, column.Type); Assert.Equal(DateTime.MinValue, column.ClrDefaultValue); }
public ColumnModel Decimal( bool?nullable = null, byte?precision = null, byte?scale = null, Decimal?defaultValue = null, string defaultValueSql = null, string name = null, string storeType = null, bool identity = false, IDictionary <string, AnnotationValues> annotations = null) { bool?nullable1 = nullable; // ISSUE: variable of a boxed type __Boxed <Decimal?> local = (System.ValueType)defaultValue; string defaultValueSql1 = defaultValueSql; int? maxLength = new int?(); byte? precision1 = precision; string str1 = name; string str2 = storeType; byte? scale1 = scale; bool? unicode = new bool?(); bool? fixedLength = new bool?(); int num = identity ? 1 : 0; string name1 = str1; string storeType1 = str2; IDictionary <string, AnnotationValues> annotations1 = annotations; return(ColumnBuilder.BuildColumn(PrimitiveTypeKind.Decimal, nullable1, (object)local, defaultValueSql1, maxLength, precision1, scale1, unicode, fixedLength, num != 0, false, name1, storeType1, annotations1)); }
public void Geometry_should_add_column_to_table_model() { var column = new ColumnBuilder().Geometry(); Assert.Equal(PrimitiveTypeKind.Geometry, column.Type); Assert.True(DbGeometry.FromText("POINT(0 0)").SpatialEquals((DbGeometry)column.ClrDefaultValue)); }
public void Long_should_add_column_to_table_model() { var column = new ColumnBuilder().Long(); Assert.Equal(PrimitiveTypeKind.Int64, column.Type); Assert.Equal(0L, column.ClrDefaultValue); }
public void Time_should_add_column_to_table_model() { var column = new ColumnBuilder().Time(); Assert.Equal(PrimitiveTypeKind.Time, column.Type); Assert.Equal(TimeSpan.Zero, column.ClrDefaultValue); }
public void Short_should_add_column_to_table_model() { var column = new ColumnBuilder().Short(); Assert.Equal(PrimitiveTypeKind.Int16, column.Type); Assert.Equal((short)0, column.ClrDefaultValue); }
public void Integer_should_add_integer_column_to_table_model() { var column = new ColumnBuilder().Int(); Assert.Equal(PrimitiveTypeKind.Int32, column.Type); Assert.Equal(0, column.ClrDefaultValue); }
public void Boolean_should_add_column_to_table_model() { var column = new ColumnBuilder().Boolean(); Assert.Equal(PrimitiveTypeKind.Boolean, column.Type); Assert.Equal(false, column.ClrDefaultValue); }
public void Double_should_add_column_to_table_model() { var column = new ColumnBuilder().Double(); Assert.Equal(PrimitiveTypeKind.Double, column.Type); Assert.Equal(0d, column.ClrDefaultValue); }
public void Can_set_column_facets_from_fluent_method_optional_args() { var column = new ColumnBuilder().String( nullable: false, maxLength: 42, fixedLength: false, unicode: true, name: "Foo", storeType: "Bar", defaultValue: "123", defaultValueSql: "getdate()"); Assert.NotNull(column); var columnModel = column; Assert.False(columnModel.IsNullable.Value); Assert.Equal(42, columnModel.MaxLength); Assert.False(columnModel.IsFixedLength.Value); Assert.True(columnModel.IsUnicode.Value); Assert.Equal("Foo", columnModel.Name); Assert.Equal("Bar", columnModel.StoreType); Assert.Equal("123", columnModel.DefaultValue); Assert.Equal("getdate()", columnModel.DefaultValueSql); }
public void String_should_add_column_to_table_model() { var column = new ColumnBuilder().String(); Assert.Equal(PrimitiveTypeKind.String, column.Type); Assert.Equal(string.Empty, column.ClrDefaultValue); }
public void Decimal_should_add_column_to_table_model() { var column = new ColumnBuilder().Decimal(); Assert.Equal(PrimitiveTypeKind.Decimal, column.Type); Assert.Equal(0m, column.ClrDefaultValue); }
public void Single_should_add_column_to_table_model() { var column = new ColumnBuilder().Single(); Assert.Equal(PrimitiveTypeKind.Single, column.Type); Assert.Equal(0f, column.ClrDefaultValue); }
public void Binary_should_add_column_to_table_model() { var column = new ColumnBuilder().Binary(); Assert.Equal(PrimitiveTypeKind.Binary, column.Type); Assert.Equal(new byte[] { }, (byte[])column.ClrDefaultValue); }
public void Annotations_are_added_to_model_when_passed_to_any_builder_method() { var builder = new ColumnBuilder(); var annotations = new Dictionary <string, AnnotationValues> { { "A1", new AnnotationValues("O1", "N1") }, { "A2", new AnnotationValues("O2", "N2") } }; VerifyAnnotations(builder.Binary(annotations: annotations)); VerifyAnnotations(builder.Boolean(annotations: annotations)); VerifyAnnotations(builder.Byte(annotations: annotations)); VerifyAnnotations(builder.DateTime(annotations: annotations)); VerifyAnnotations(builder.DateTimeOffset(annotations: annotations)); VerifyAnnotations(builder.Decimal(annotations: annotations)); VerifyAnnotations(builder.Double(annotations: annotations)); VerifyAnnotations(builder.Geography(annotations: annotations)); VerifyAnnotations(builder.Geometry(annotations: annotations)); VerifyAnnotations(builder.Guid(annotations: annotations)); VerifyAnnotations(builder.Int(annotations: annotations)); VerifyAnnotations(builder.Long(annotations: annotations)); VerifyAnnotations(builder.Short(annotations: annotations)); VerifyAnnotations(builder.Single(annotations: annotations)); VerifyAnnotations(builder.String(annotations: annotations)); VerifyAnnotations(builder.Time(annotations: annotations)); }
public ColumnModel String( bool?nullable = null, int?maxLength = null, bool?fixedLength = null, bool?unicode = null, string defaultValue = null, string defaultValueSql = null, string name = null, string storeType = null, IDictionary <string, AnnotationValues> annotations = null) { bool? nullable1 = nullable; string str = defaultValue; string defaultValueSql1 = defaultValueSql; int? maxLength1 = maxLength; bool? nullable2 = fixedLength; byte? precision = new byte?(); byte? scale = new byte?(); bool? unicode1 = unicode; bool? fixedLength1 = nullable2; string name1 = name; string storeType1 = storeType; IDictionary <string, AnnotationValues> annotations1 = annotations; return(ColumnBuilder.BuildColumn(PrimitiveTypeKind.String, nullable1, (object)str, defaultValueSql1, maxLength1, precision, scale, unicode1, fixedLength1, false, false, name1, storeType1, annotations1)); }
public void Can_set_identity_facet_from_fluent_method_optional_args() { var column = new ColumnBuilder().Int(identity: true); Assert.NotNull(column); var columnModel = column; Assert.True(columnModel.IsIdentity); }
public ColumnModel Boolean( bool?nullable = null, bool?defaultValue = null, string defaultValueSql = null, string name = null, string storeType = null, IDictionary <string, AnnotationValues> annotations = null) { return(ColumnBuilder.BuildColumn(PrimitiveTypeKind.Boolean, nullable, (object)defaultValue, defaultValueSql, new int?(), new byte?(), new byte?(), new bool?(), new bool?(), false, false, name, storeType, annotations)); }
public ColumnModel DateTimeOffset( bool?nullable = null, byte?precision = null, DateTimeOffset?defaultValue = null, string defaultValueSql = null, string name = null, string storeType = null, IDictionary <string, AnnotationValues> annotations = null) { return(ColumnBuilder.BuildColumn(PrimitiveTypeKind.DateTimeOffset, nullable, (object)defaultValue, defaultValueSql, new int?(), precision, new byte?(), new bool?(), new bool?(), false, false, name, storeType, annotations)); }
public ColumnModel Binary( bool?nullable = null, int?maxLength = null, bool?fixedLength = null, byte[] defaultValue = null, string defaultValueSql = null, bool timestamp = false, string name = null, string storeType = null, IDictionary <string, AnnotationValues> annotations = null) { return(ColumnBuilder.BuildColumn(PrimitiveTypeKind.Binary, nullable, (object)defaultValue, defaultValueSql, maxLength, new byte?(), new byte?(), new bool?(), fixedLength, false, timestamp, name, storeType, annotations)); }
public void Annotations_are_empty_but_not_null_in_model_if_not_passed_to_builder() { var builder = new ColumnBuilder(); Assert.Equal(0, builder.Binary().Annotations.Count); Assert.Equal(0, builder.Boolean().Annotations.Count); Assert.Equal(0, builder.Byte().Annotations.Count); Assert.Equal(0, builder.DateTime().Annotations.Count); Assert.Equal(0, builder.DateTimeOffset().Annotations.Count); Assert.Equal(0, builder.Decimal().Annotations.Count); Assert.Equal(0, builder.Double().Annotations.Count); Assert.Equal(0, builder.Geography().Annotations.Count); Assert.Equal(0, builder.Geometry().Annotations.Count); Assert.Equal(0, builder.Guid().Annotations.Count); Assert.Equal(0, builder.Int().Annotations.Count); Assert.Equal(0, builder.Long().Annotations.Count); Assert.Equal(0, builder.Short().Annotations.Count); Assert.Equal(0, builder.Single().Annotations.Count); Assert.Equal(0, builder.String().Annotations.Count); Assert.Equal(0, builder.Time().Annotations.Count); }
public void Annotations_are_added_to_model_when_passed_to_any_builder_method() { var builder = new ColumnBuilder(); var annotations = new Dictionary<string, AnnotationValues> { { "A1", new AnnotationValues("O1", "N1") }, { "A2", new AnnotationValues("O2", "N2") } }; VerifyAnnotations(builder.Binary(annotations: annotations)); VerifyAnnotations(builder.Boolean(annotations: annotations)); VerifyAnnotations(builder.Byte(annotations: annotations)); VerifyAnnotations(builder.DateTime(annotations: annotations)); VerifyAnnotations(builder.DateTimeOffset(annotations: annotations)); VerifyAnnotations(builder.Decimal(annotations: annotations)); VerifyAnnotations(builder.Double(annotations: annotations)); VerifyAnnotations(builder.Geography(annotations: annotations)); VerifyAnnotations(builder.Geometry(annotations: annotations)); VerifyAnnotations(builder.Guid(annotations: annotations)); VerifyAnnotations(builder.Int(annotations: annotations)); VerifyAnnotations(builder.Long(annotations: annotations)); VerifyAnnotations(builder.Short(annotations: annotations)); VerifyAnnotations(builder.Single(annotations: annotations)); VerifyAnnotations(builder.String(annotations: annotations)); VerifyAnnotations(builder.Time(annotations: annotations)); }
public void DateTimeOffset_should_add_column_to_table_model() { var column = new ColumnBuilder().DateTimeOffset(); Assert.Equal(PrimitiveTypeKind.DateTimeOffset, column.Type); Assert.Equal(DateTimeOffset.MinValue, column.ClrDefaultValue); }