Пример #1
0
        public CalendarroObjects CreateCalendarroObject(int ChooseWhichObject)
        {
            CalendarroObjects CreatedObject = null;
            Random            rand          = new Random();

            switch (ChooseWhichObject)
            {
            case 1:
                CreatedObject = new CalendarroObjects()
                {
                    Kanban = new KanbanDto
                    {
                        Name      = "example",
                        ProjectId = rand.Next(1, 5)
                    }
                };
                return(CreatedObject);

            case 2:
                CreatedObject = new CalendarroObjects()
                {
                    Relation = new RelationDto()
                    {
                        UserId    = rand.Next(1, int.MaxValue),
                        ProjectId = rand.Next(1, int.MaxValue)
                    }
                };
                return(CreatedObject);

            case 3:
                CreatedObject = new CalendarroObjects()
                {
                    ProjectTask = new TaskDto()
                    {
                        CreateDate = DateTime.Now,
                        TaskName   = "example",
                        FinishDate = DateTime.Now,
                        UserId     = rand.Next(1, 5),
                        ProjectId  = rand.Next(1, 5),
                        KanbanId   = rand.Next(1, 5)
                    }
                };
                return(CreatedObject);

            default:
                return(CreatedObject);
            }
        }
Пример #2
0
        public void checkCalendarroFactory()
        {
            bool check = true;
            CalendarroFactory factory = new CalendarroFactory();
            int LoopCount             = rand.Next(1, 200);

            for (int i = 0; i < LoopCount; i++)
            {
                CalendarroObjects objects = factory.CreateCalendarroObject(rand.Next(1, 4));

                if (objects == null)
                {
                    check = false;
                }
            }

            Assert.IsTrue(check);
        }