/// <summary> /// Using static Mapper, uses <see cref="RandomValuesHelper"/> to create a new <typeparamref name="TSource"/> instance, /// maps it to a new <typeparamref name="TDestination"/> instance, and /// calls <see cref="MapTester{TSource, TDestination}.AssertMappedValues(TSource, TDestination)"/>. /// </summary> /// <typeparam name="TSource">The type of the source.</typeparam> /// <typeparam name="TDestination">The type of the destination.</typeparam> /// <param name="mapTester">The <see cref="MapTester{TSource, TDestination}"/>.</param> /// <returns>The mapped <typeparamref name="TDestination"/> instance.</returns> public static TDestination AssertAutoMappedRandomValues <TSource, TDestination>( this MapTester <TSource, TDestination> mapTester) { var source = new RandomValuesHelper().CreateInstanceWithRandomValues <TSource>(); return(mapTester.AssertAutoMappedValues(source)); }
public void AssertAutoMappedValues_with_IMapper_should_work() { Source source = new RandomValuesHelper().CreateInstanceWithRandomValues <Source>(); Dest dest = null; AssertExceptionNotThrown.WhenExecuting(() => dest = MapTester.ForMap <Source, Dest>().AssertAutoMappedValues(_mapper, source)); Assert.IsInstanceOfType(dest, typeof(Dest)); Console.WriteLine(JsonConvert.SerializeObject(dest)); }
public void CreateInstanceWithRandomValues_should_work() { var dummy = new RandomValuesHelper().CreateInstanceWithRandomValues <Dummy>(); Console.WriteLine( JsonConvert.SerializeObject( dummy, new IsoDateTimeConverter { DateTimeFormat = "MM/dd/yyyy hh:mm:ss" }, new StringEnumConverter())); }
public void WithMaximumDepth_should_work() { var helper = new RandomValuesHelper(); var result = helper.CreateInstanceWithRandomValues <Depth1>(); Assert.IsNotNull(result.Depth2.Depth3.Depth4, "No maximum depth"); result = helper.WithMaximumDepth(3).CreateInstanceWithRandomValues <Depth1>(); Assert.IsNull(result.Depth2.Depth3.Depth4, $"Maximum depth {helper.MaximumDepth}"); result = helper.WithMaximumDepth(2).CreateInstanceWithRandomValues <Depth1>(); Assert.IsNull(result.Depth2.Depth3, $"Maximum depth {helper.MaximumDepth}"); result = helper.WithMaximumDepth(1).CreateInstanceWithRandomValues <Depth1>(); Assert.IsNull(result.Depth2, $"Maximum depth {helper.MaximumDepth}"); }
public void RandomEnumValue_should_work() { StringComparison randomValue = new RandomValuesHelper().RandomEnumValue <StringComparison>(); Assert.IsNotNull(randomValue); }
public void RandomString_with_prefix_should_work() { string randomValue = new RandomValuesHelper().RandomString("testPrefix"); StringAssert.StartsWith(randomValue, "testPrefix"); }
public void RandomString_should_work() { string randomValue = new RandomValuesHelper().RandomString(); Assert.IsNotNull(randomValue); }
public void RandomFloat_should_work() { float randomValue = new RandomValuesHelper().RandomFloat(); Assert.IsNotNull(randomValue); }
public void RandomChar_should_work() { char randomValue = new RandomValuesHelper().RandomChar(); Assert.IsNotNull(randomValue); }
public void RandomGuid_should_work() { Guid randomValue = new RandomValuesHelper().RandomGuid(); Assert.IsNotNull(randomValue); }
public void RandomDouble_should_work() { double randomValue = new RandomValuesHelper().RandomDouble(); Assert.IsNotNull(randomValue); }
public void RandomDecimal_should_work() { decimal randomValue = new RandomValuesHelper().RandomDecimal(); Assert.IsNotNull(randomValue); }
public void TestInitialize() { _randomValuesHelper = new RandomValuesHelper(); }
public void RandomBool_should_work() { bool randomValue = new RandomValuesHelper().RandomBool(); Assert.IsNotNull(randomValue); }
public void RandomInt_should_work() { int randomValue = new RandomValuesHelper().RandomInt(); Assert.IsNotNull(randomValue); }
public void RandomByte_should_work() { byte randomValue = new RandomValuesHelper().RandomByte(); Assert.IsNotNull(randomValue); }
public void RandomUShort_should_work() { ushort randomValue = new RandomValuesHelper().RandomUShort(); Assert.IsNotNull(randomValue); }
public void RandomDateTime_should_work() { DateTime randomValue = new RandomValuesHelper().RandomDateTime(); Assert.IsNotNull(randomValue); }
public void TestInitialize() { _randomValuesHelper = new RandomValuesHelper(); _source = _randomValuesHelper.CreateInstanceWithRandomValues <Source>(); _mapTester = MapTester.ForMap <Source, Dest>(); }