Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            January j1 = new January();

            Console.WriteLine($"This month is {j1.SequenceOfMonth()}th month of the year and has {j1.DaysOfAMonth()} days and one day has {j1.HoursOfADay()} hours");
            February f1 = new February();

            Console.WriteLine($"This month is {f1.SequenceOfMonth()}th month of the year and has {f1.DaysOfAMonth()} days");
        }
Ejemplo n.º 2
0
        public void changeMonth()
        {
            Player     player = new Player("Max", new string[] { "he", "him", "his" });
            MainSim    sim    = new MainSim();
            MonthState month  = new January(player, sim);

            sim.CurrState = month;

            month.GoNext();

            Assert.IsTrue(sim.CurrState.GetType() == typeof(February));
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            var jan    = new January();
            var random = new Random();
            var a      = string.Empty;

            while (a != " ")
            {
                var day = random.Next(1, jan.NumberOfDays + 1);
                PrintNames(day, jan.Name, jan.GetNamesForDay(day));
                a = Console.ReadLine();
            }
        }
Ejemplo n.º 4
0
 public void TimeIdentifiersAreAlikeWhenTheyAreEqual()
 {
     Assert.True(AcademicYear.IsAlike(AcademicYear));
     Assert.True(CalendarYear.IsAlike(CalendarYear));
     Assert.True(FinancialYear.IsAlike(FinancialYear));
     Assert.True(TaxYear.IsAlike(TaxYear));
     Assert.True(AcademicYearQ1.IsAlike(AcademicYearQ1));
     Assert.True(CalendarYearQ1.IsAlike(CalendarYearQ1));
     Assert.True(FinancialYearQ1.IsAlike(FinancialYearQ1));
     Assert.True(TaxYearQ1.IsAlike(TaxYearQ1));
     Assert.True(January.IsAlike(January));
     Assert.True(SpringTerm.IsAlike(SpringTerm));
     Assert.True(ReportingYear.IsAlike(ReportingYear));
     Assert.True(Week1.IsAlike(Week1));
     Assert.True(FinancialYearPart1.IsAlike(FinancialYearPart1));
 }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 public string this[int indexer]
 {
     get
     {
         switch (indexer)
         {
             case 0:
                 January jan = new January();
                 return jan.ToString();
             case 1:
                 February f = new February();
                 return f.ToString();
             case 2:
                 March m = new March();
                 return m.ToString();
             case 3:
                 April a = new April();
                 return a.ToString();
             case 4:
                 May may = new May();
                 return may.ToString();
             case 5:
                 June j = new June();
                 return j.ToString();
             case 6:
                 July july = new July();
                 return july.ToString();
             case 7:
                 August august = new August();
                 return august.ToString();
             case 8:
                 September s = new September();
                 return s.ToString();
             case 9:
                 October o = new October();
                 return o.ToString();
             case 10:
                 November n = new November();
                 return n.ToString();
             case 11:
                 December d = new December();
                 return d.ToString();
             default: throw new Exception("No such index");
         }
     }
 }
Ejemplo n.º 8
0
 public string this[string indexer]
 {
     get
     {
         switch (indexer)
         {
             case "January": 
                 January jan= new January();
                 return jan.ToString();
             case "February":
                 February f = new February();
                 return f.ToString();
             case "March":
                 March m = new March();
                 return m.ToString();
             case "April":
                 April a = new April();
                 return a.ToString();
             case "May":
                 May may = new May();
                 return may.ToString();
             case "June":
                 June j = new June();
                 return j.ToString();
             case "July":
                 July july = new July();
                 return july.ToString();
             case "August":
                 August august = new August();
                 return august.ToString();
             case "September":
                 September s = new September();
                 return s.ToString();
             case "October":
                 October o = new October();
                 return o.ToString();
             case "November":
                 November n = new November();
                 return n.ToString();
             case "December":
                 December d = new December();
                 return d.ToString();
             default: throw new Exception("No such index");
         }
     }
 }
Ejemplo n.º 9
0
 public void GetAssociatedRangeForMonthReturnsAssociatedRange()
 {
     Assert.Equal(TimeIdentifierUtil.GetMonths(), January.GetAssociatedRange());
 }
Ejemplo n.º 10
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();
        }