public void It_should_generate_sequential_dates_incrementing_by_day(int index, int expectedYear, int expectedMonth, int expectedDay) { var transform = new FillWithSequentialValuesTransformFactory() .GetTransform <ClassWithManyDifferentTypesOfProperties>(); var instance = new ClassWithManyDifferentTypesOfProperties(); transform.ApplyTo(instance, index); instance.DateTimeProperty.Should().Be(new DateTime(expectedYear, expectedMonth, expectedDay)); }
public void It_should_generate_sequential_dates_incrementing_by_ticks(int index, int incrementedTicks) { var transform = new FillWithSequentialValuesTransformFactory(new RecursiveTransformFactoryOptions { DateTimeIncrements = DateTimeIncrements.Ticks }) .GetTransform <ClassWithManyDifferentTypesOfProperties>(); var instance = new ClassWithManyDifferentTypesOfProperties(); transform.ApplyTo(instance, index); instance.DateTimeProperty.Should().Be(RecursiveTransformFactoryOptions.DefaultStartDate.Date + TimeSpan.FromTicks(incrementedTicks)); }
public void UShort_should_reset_to_1_when_overflowing() { var transform = _factory.GetTransform <ClassWithManyDifferentTypesOfProperties>(); var instance = new ClassWithManyDifferentTypesOfProperties(); transform.ApplyTo(instance, index: ushort.MaxValue - 1); instance.UShortProperty.Should().Be(ushort.MaxValue); transform.ApplyTo(instance, index: ushort.MaxValue); instance.UShortProperty.Should().Be(1); transform.ApplyTo(instance, index: ushort.MaxValue + 1); instance.UShortProperty.Should().Be(2); transform.ApplyTo(instance, index: ushort.MaxValue * 2); instance.UShortProperty.Should().Be(1); }
public void It_should_generate_sequential_dates_based_on_the_start_date(int index, int startYear, int startMonth, int startDay, int incrementedDays) { var startDate = new DateTime(startYear, startMonth, startDay); var transform = new FillWithSequentialValuesTransformFactory(new RecursiveTransformFactoryOptions { DateTimeIncrements = DateTimeIncrements.Days, StartDate = startDate }) .GetTransform <ClassWithManyDifferentTypesOfProperties>(); var instance = new ClassWithManyDifferentTypesOfProperties(); transform.ApplyTo(instance, index); instance.DateTimeProperty.Should().Be(startDate + TimeSpan.FromDays(incrementedDays)); }
public void It_should_fill_properties_with_sequential_values(int index, int sequentialNumberExpected) { var transform = new FillWithSequentialValuesTransformFactory() .GetTransform <ClassWithManyDifferentTypesOfProperties>(); var instance = new ClassWithManyDifferentTypesOfProperties(); transform.ApplyTo(instance, index); instance.StringProperty.Should().Be($"StringProperty{sequentialNumberExpected}"); instance.ByteProperty.Should().Be((byte)sequentialNumberExpected, "byte properties should be filled"); instance.ShortProperty.Should().Be((short)sequentialNumberExpected); instance.UShortProperty.Should().Be((ushort)sequentialNumberExpected); instance.IntProperty.Should().Be(sequentialNumberExpected); instance.UIntProperty.Should().Be((uint)sequentialNumberExpected); instance.LongProperty.Should().Be(sequentialNumberExpected); instance.ULongProperty.Should().Be((ulong)sequentialNumberExpected); instance.FloatProperty.Should().Be(sequentialNumberExpected); instance.DoubleProperty.Should().Be(sequentialNumberExpected); instance.DecimalProperty.Should().Be(sequentialNumberExpected); }