public void Can_covert_to_and_from_DateTime() { var annotation = new TypedAnnotation(new DateTime(1973, 9, 3, 0, 10, 1, 333)); Assert.Equal(new DateTime(1973, 9, 3, 0, 10, 1, 333), annotation.Value); Assert.Equal(new DateTime(1973, 9, 3, 0, 10, 1, 333), new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_double() { var annotation = new TypedAnnotation((double)42); Assert.Equal((double)42, annotation.Value); Assert.Equal((double)42, new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_bool() { var annotation = new TypedAnnotation(true); Assert.Equal(true, annotation.Value); Assert.Equal(true, new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_long() { var annotation = new TypedAnnotation(42L); Assert.Equal(42L, annotation.Value); Assert.Equal(42L, new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_TimeSpan() { var annotation = new TypedAnnotation(new TimeSpan(-8, 1, 3)); Assert.Equal(new TimeSpan(-8, 1, 3), annotation.Value); Assert.Equal(new TimeSpan(-8, 1, 3), new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_string() { var annotation = new TypedAnnotation("Forty Two"); Assert.Equal("Forty Two", annotation.Value); Assert.Equal("Forty Two", new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_char() { var annotation = new TypedAnnotation(' '); Assert.Equal(' ', annotation.Value); Assert.Equal(' ', new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_DateTimeOffset() { var dateTimeOffset = new DateTimeOffset(new DateTime(1973, 9, 3, 0, 10, 1, 333), new TimeSpan(-8, 0, 0)); var annotation = new TypedAnnotation(dateTimeOffset); Assert.Equal(dateTimeOffset, annotation.Value); Assert.Equal(dateTimeOffset, new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_Guid() { var guid = new Guid("{6569CBEA-1E24-4D3E-A60E-6B663B4831F8}"); var annotation = new TypedAnnotation(guid); Assert.Equal(guid, annotation.Value); Assert.Equal(guid, new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
public void Can_covert_to_and_from_byte_array() { var annotation = new TypedAnnotation(new Byte[] { 69, 70, 32, 82, 79, 67, 75, 83 }); Assert.Equal(new Byte[] { 69, 70, 32, 82, 79, 67, 75, 83 }, annotation.Value); Assert.Equal( new Byte[] { 69, 70, 32, 82, 79, 67, 75, 83 }, new TypedAnnotation(annotation.TypeString, annotation.ValueString).Value); }
protected virtual bool SetDefaultValue([CanBeNull] object value) { var typedAnnotation = new TypedAnnotation(value); return Annotations.SetAnnotation(RelationalAnnotationNames.DefaultValueType, typedAnnotation.TypeString) && Annotations.SetAnnotation(RelationalAnnotationNames.DefaultValue, typedAnnotation.ValueString); }