public void Dates_2() { var generator = new RandomGenerator(); var products = Builder <Product> .CreateListOfSize(100) .All() .With(x => x.Created = generator.Next(July.The(1), November.The(10))) .Build(); }
public void Dates_2() { BuilderSettings builderSettings = new BuilderSettings(); var generator = new RandomGenerator(); var products = new Builder(builderSettings) .CreateListOfSize <Product>(100) .All() .With(x => x.Created = generator.Next(July.The(1), November.The(10))) .Build(); }
public void Using_random_dates() { var generator = new RandomGenerator(); var products = Builder <Product> .CreateListOfSize(100) .All() .With(x => x.Created = generator.Next(July.The(1), November.The(10))) .Build(); var expectedStart = new DateTime(DateTime.Now.Year, 7, 1, 00, 00, 00); var expectedEnd = new DateTime(DateTime.Now.Year, 11, 10, 00, 00, 00); foreach (var product in products) { Assert.That(product.Created, Is.AtLeast(expectedStart)); Assert.That(product.Created, Is.AtMost(expectedEnd)); } }
public void Using_random_dates() { var builderSetup = new BuilderSettings(); var generator = new RandomGenerator(); var products = new Builder(builderSetup) .CreateListOfSize <Product>(100) .All() .With(x => x.Created = generator.Next(July.The(1), November.The(10))) .Build(); var expectedStart = new DateTime(DateTime.Now.Year, 7, 1, 00, 00, 00); var expectedEnd = new DateTime(DateTime.Now.Year, 11, 10, 00, 00, 00); foreach (var product in products) { product.Created.ShouldBeGreaterThanOrEqualTo(expectedStart); product.Created.ShouldBeLessThanOrEqualTo(expectedEnd); } }
public void Can_use_static_months() { DateTime date = January.The(1); Assert.That(date.Month, Is.EqualTo(1)); date = February.The(1); Assert.That(date.Month, Is.EqualTo(2)); date = March.The(1); Assert.That(date.Month, Is.EqualTo(3)); date = April.The(1); Assert.That(date.Month, Is.EqualTo(4)); date = May.The(1); Assert.That(date.Month, Is.EqualTo(5)); date = June.The(1); Assert.That(date.Month, Is.EqualTo(6)); date = July.The(1); Assert.That(date.Month, Is.EqualTo(7)); date = August.The(1); Assert.That(date.Month, Is.EqualTo(8)); date = September.The(1); Assert.That(date.Month, Is.EqualTo(9)); date = October.The(1); Assert.That(date.Month, Is.EqualTo(10)); date = November.The(1); Assert.That(date.Month, Is.EqualTo(11)); date = December.The(1); Assert.That(date.Month, Is.EqualTo(12)); }
public void Can_use_static_months() { DateTime date = January.The(1); date.Month.ShouldBe(1); date = February.The(1); date.Month.ShouldBe(2); date = March.The(1); date.Month.ShouldBe(3); date = April.The(1); date.Month.ShouldBe(4); date = May.The(1); date.Month.ShouldBe(5); date = June.The(1); date.Month.ShouldBe(6); date = July.The(1); date.Month.ShouldBe(7); date = August.The(1); date.Month.ShouldBe(8); date = September.The(1); date.Month.ShouldBe(9); date = October.The(1); date.Month.ShouldBe(10); date = November.The(1); date.Month.ShouldBe(11); date = December.The(1); date.Month.ShouldBe(12); }
public void Dates_1() { The.Year(2006).On.May.The10th.At(09, 00); On.July.The21st.At(07, 00); var aug11 = August.The11th; July.The(1); November.The(10); The.Year(2008).On.January.The10th.At(05, 49, 38); var created = On.May.The14th; Today.At(09, 00); // (These generate TimeSpans) The.Time(08, 31); At.Time(09, 46); }