示例#1
0
        public void TestAssigment1_WithoutMajority()
        {
            //Arrange
            int[] testArray =
            {
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2,
                3, 1, 3, 2, 3, 4, 3, 9, 3, 7, 3, 8, 3, 5, 3, 2, 2
            };
            bool        HasAMajorityNumber;
            Assignment1 ass1 = new Assignment1();

            //Act and Assert
            Assert.IsFalse(ass1.HasMajority(testArray), "wrong");
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Assignment1 assignment1 = db.Assignment1s.Find(id);

            db.Assignment1s.Remove(assignment1);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,CoordinatorToFacultyId,StartDate,EndDate")] Assignment1 assignment1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assignment1).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CoordinatorToFacultyId = new SelectList(db.CoordinatorToFacultys, "Id", "Id", assignment1.CoordinatorToFacultyId);
     return(View(assignment1));
 }
        // GET: Assignment1/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Assignment1 assignment1 = db.Assignment1s.Find(id);

            if (assignment1 == null)
            {
                return(HttpNotFound());
            }
            return(View(assignment1));
        }
示例#5
0
        static void Main(string[] args)
        {
            Assignment1 App = new Assignment1();

            App.Run(); //This is a Task. If we want to do someting fun below, we are free to do so :)

            int counter = 0;

            while (true)
            {
                Thread.Sleep(1000);
                counter += 1;
                //Console.WriteLine($"Hanging around in Main()...waiting for someting fun... {counter}");
            }
        }
        // GET: Assignment1/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Assignment1 assignment1 = db.Assignment1s.Find(id);

            if (assignment1 == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CoordinatorToFacultyId = new SelectList(db.CoordinatorToFacultys, "Id", "Id", assignment1.CoordinatorToFacultyId);
            return(View(assignment1));
        }
        static void Main(string[] args)
        {
            Assignment1 assignment = new Assignment1();

            do
            {
                Console.Write("Enter question number (1-3) or any other number to exit: ");
                int control = Convert.ToInt32(Console.ReadLine());
                if (control > 3)
                {
                    break;
                }
                switch (control)
                {
                case 1:
                    Console.WriteLine("Program to give true if sum of two numbers is > 500");
                    Console.Write("Enter first number :");
                    int num1 = Convert.ToInt32(Console.ReadLine());
                    Console.Write("Enter second number :");
                    int  num2   = Convert.ToInt32(Console.ReadLine());
                    bool result = assignment.SumGreaterThan500(num1, num2);
                    Console.WriteLine(result);
                    break;

                case 2:
                    Console.WriteLine("Program to show total points for given wins, draws and looses");

                    Console.Write("Enter number of wins: ");
                    int wins = Convert.ToInt32(Console.ReadLine());
                    Console.Write("Enter number of draws: ");
                    int draws = Convert.ToInt32(Console.ReadLine());
                    Console.Write("Enter number of losses: ");
                    int losses = Convert.ToInt32(Console.ReadLine());
                    assignment.PointCalculator(wins: wins, draws: draws, loose: losses);
                    break;

                case 3:
                    Console.WriteLine("Program to print the initials of name");

                    Console.Write("Enter your full Name : ");
                    string name = Console.ReadLine();
                    Console.WriteLine(name);
                    Console.WriteLine($"The initials is: {assignment.GetInitials(name)}");
                    break;
                }
            } while (true);
        }
示例#8
0
 public void SetUp()
 {
     _assignment1 = new Assignment1();
 }
 public void SetUp()
 {
     _math = new Assignment1();
 }
示例#10
0
 static void Main()
 {
     Assignment1.Ex1();
     Console.ReadKey();
 }
示例#11
0
 public void SetUp()
 {
     UserW = new Assignment1();
 }