コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        protected override void Seed(ApplicationContext context)
        {
            var generator = new RandomGenerator();

            var posts = Builder <Post> .CreateListOfSize(100).All()
                        .With(c => c.Claim            = Faker.Lorem.Sentence())
                        .With(c => c.OpeningStatement = Faker.Lorem.Paragraph())
                        .With(c => c.Date             = generator.Next(January.The(1), December.The(31)))
                        .With(c => c.Score            = Faker.RandomNumber.Next(-100, 10000))
                        .Build();

            context.Posts.AddOrUpdate(c => c.PostID, posts.ToArray());
            context.SaveChanges();

            var arguments = Builder <Argument> .CreateListOfSize(1000).All()
                            .With(c => c.Body        = Faker.Lorem.Paragraph())
                            .With(c => c.Affirmative = BooleanGenerator())
                            .With(c => c.Score       = Faker.RandomNumber.Next(-100, 10000))
                            .With(c => c.PostID      = Faker.RandomNumber.Next(1, 100))
                            .Build();

            context.Arguments.AddOrUpdate(c => c.ArgumentID, arguments.ToArray());
            context.SaveChanges();

            var crossExaminations = Builder <CrossExamination> .CreateListOfSize(500).All()
                                    .With(c => c.Body       = Faker.Lorem.Paragraph())
                                    .With(c => c.Score      = Faker.RandomNumber.Next(-100, 10000))
                                    .With(c => c.ArgumentID = Faker.RandomNumber.Next(1, 1000))
                                    .Build();

            context.CrossExaminations.AddOrUpdate(c => c.CrossExaminationID, crossExaminations.ToArray());
            context.SaveChanges();

            var sources = Builder <Source> .CreateListOfSize(1000).All()
                          .With(c => c.ArgumentID         = null)
                          .With(c => c.CrossExaminationID = null)
                          .With(c => c.URL           = Faker.Internet.DomainName())
                          .With(c => c.PublishedDate = generator.Next(January.The(1), December.The(31)))
                          .With(c => c.Author        = Faker.Name.FullName())
                          .With(c => c.Description   = Faker.Lorem.Sentence())
                          .TheFirst(500)
                          .With(c => c.ArgumentID = Faker.RandomNumber.Next(1, 1000))
                          .TheLast(500)
                          .With(c => c.CrossExaminationID = Faker.RandomNumber.Next(1, 500))
                          .Build();

            context.Sources.AddOrUpdate(c => c.SourceID, sources.ToArray());
            context.SaveChanges();

            var tags = Builder <Tag> .CreateListOfSize(100).Build();

            context.Tags.AddOrUpdate(c => c.TagID, tags.ToArray());
            context.SaveChanges();

            var tagRelations = Builder <TagRelation> .CreateListOfSize(500).All()
                               .With(c => c.TagID  = Faker.RandomNumber.Next(1, 100))
                               .With(c => c.PostID = Faker.RandomNumber.Next(1, 100))
                               .Build();

            context.TagRelations.AddOrUpdate(c => c.TagRelationID, tagRelations.ToArray());
            context.SaveChanges();
        }