private void TestDefault(ValueTypeConvertOptions opts) { // Returns a value Assert.NotNull(opts); // Always the same instance Assert.Same(opts, ValueTypeConvertOptions.Default); // Expected configuration Assert.Equal(ValueTypeConvertFlags.None, opts.ConvertFlags); }
public void Flags() { var opts = new ValueTypeConvertOptions(ValueTypeConvertFlags.NullToValueDefault); Assert.Equal(ValueTypeConvertFlags.NullToValueDefault, opts.ConvertFlags); Assert.True(opts.NullToValueDefault); opts = new ValueTypeConvertOptions(ValueTypeConvertFlags.None); Assert.Equal(ValueTypeConvertFlags.None, opts.ConvertFlags); Assert.False(opts.NullToValueDefault); }
public void FromConvertOptions() { var stringOpts = new StringConvertOptions(StringAsNullOption.NullReference, TrimStringFlags.None); var valOpts = new ValueTypeConvertOptions(ValueTypeConvertFlags.None); var complexOpts = new ComplexNumberConvertOptions(ComplexNumberElement.Real); var boolOpts = new BooleanConvertOptions(new[] { bool.TrueString }, new[] { bool.FalseString }); var enumOpts = new EnumConvertOptions(UndefinedValueOption.Throw, UndefinedValueOption.Throw); var numberOpts = new NumberConvertOptions(ParseNumericStringFlags.None); var opts = new ConvertOptions(new OptionSet[] { stringOpts, valOpts, complexOpts, boolOpts, enumOpts, numberOpts }); var builder = ConvertOptionsBuilder.FromConvertOptions(opts); Assert.Equal(6, builder.Count()); Assert.Contains(stringOpts, builder); Assert.Contains(valOpts, builder); Assert.Contains(complexOpts, builder); Assert.Contains(boolOpts, builder); Assert.Contains(enumOpts, builder); Assert.Contains(numberOpts, builder); }
public void Ctor() { var opts = new ValueTypeConvertOptions(ValueTypeConvertFlags.NullToValueDefault); Assert.NotNull(opts); }
public ConvertOptions(BooleanConvertOptions booleanOptions, EnumConvertOptions enumOptions, NumberConvertOptions numberOptions, StringConvertOptions stringOptions, ValueTypeConvertOptions valueTypeOptions, params OptionSet[] otherOptions);