コード例 #1
0
        public void GetAllStudentsTestSucces()
        {
            //Arrange
            Service1 service = new Service1();

            //Act
            service.AddStudent("Bob");
            service.AddStudent("Joe");
            service.GetAllStudents();
        }
コード例 #2
0
        public void RemoveStudentTest()
        {
            //act
            var service1 = new Service1();

            //arrange
            service1.AddStudent(1, "john", "5G");
            service1.AddStudent(9, "Conrad", "8S");

            service1.RemoveStudent(9);

            Assert.IsNull(service1.FindStudent(9));
        }
コード例 #3
0
        public void IdTest()
        {
            var service1 = new Service1();

            service1.AddStudent(22, "Niko", "F*g");
            Assert.AreEqual(22, service1.FindStudent(22).GetStudentID);
        }
コード例 #4
0
        public void FagTest()
        {
            var service1 = new Service1();

            service1.AddStudent(22, "Niko", "F*g");
            Assert.AreEqual("F*g", service1.FindStudent(22).GetClass);
        }
コード例 #5
0
        public void EditTestClass()
        {
            var service1 = new Service1();

            service1.AddStudent(22, "Niko", "F*g");
            service1.EditStudent(22, "Lars", "Gym");
            Assert.AreEqual("Gym", service1.FindStudent(22).GetClass);
        }
コード例 #6
0
        public void AddStudentTestSuccess()
        {
            //Arrange
            Service1 service = new Service1();

            //Act
            service.AddStudent(1, "Bob");
        }
コード例 #7
0
        public void Service1Test()
        {
            //arrange
            Service1 service = new Service1();

            //act
            service.AddStudent("Jonas", "9A", 2);
        }
コード例 #8
0
        public void RemoveTest()
        {
            var service1 = new Service1();

            service1.AddStudent(22, "Niko", "F*g");
            service1.RemoveStudent(22);

            Assert.IsNull(service1.FindStudent(22));
        }
コード例 #9
0
        public void RemoveStudentTestSucces()
        {
            //Arrange
            Service1 service = new Service1();

            //Act
            service.AddStudent("Joe");
            service.RemoveStudent("Joe");
        }
コード例 #10
0
        public void FindStudentTestSucces()
        {
            //Arrange
            Service1 service = new Service1();

            //Act
            service.AddStudent("Bob");
            service.FindStudent("Bob");
        }
コード例 #11
0
        public void EditStudentTestSucces()
        {
            //Arrange
            Service1 service = new Service1();

            //Act
            service.AddStudent("123");
            service.EditStudent("123", "Bob");
        }
コード例 #12
0
        public void AddStudentTest()
        {
            // Arrange
            Service1 s1Client = new Service1();

            // Act
            var s1 = s1Client.AddStudent("Bruce wayne", "13b", 7, 4);

            Assert.AreEqual("Bruce wayne", s1.Name);
        }
コード例 #13
0
        public void AddStudentTest()
        {
            // Arrange
            Service1 sClient = new Service1();
            // Act
            var s1 = sClient.AddStudent("Lasse", "J105", "3F", "240994-XXXX");

            // Assert
            Assert.AreEqual("Lasse", s1.StudentName);
        }
コード例 #14
0
        public void FindStudentTest()
        {
            // Arrange
            Service1 s1Client = new Service1();

            // Act
            var s1 = s1Client.AddStudent("Naruto", "13b", 7, 4);

            var s2 = s1Client.FindStudent("Naruto");

            Assert.AreEqual(s1.ClassName, s2.ClassName);
            Assert.AreEqual(s1.Room, s2.Room);
        }
コード例 #15
0
        static void Main(string[] args)
        {
            Service1 service = new Service1();
            String   line    = Console.ReadLine();
            String   myline  = Console.ReadLine();

            while (!line.Trim().ToLower().Equals("stop"))
            {
                Console.WriteLine("Hvilken funktion vil du have? opret, edit, remove, find, getall. eller skriv stop for at stoppe");
                myline = Console.ReadLine().Trim() ?? "";
                if (myline.ToLower().Equals("opret"))
                {
                    Console.WriteLine("Skriv id og navn");
                    int    a = 0;
                    string b = "";
                    for (int i = 0; i < 2; i++)
                    {
                        if (a == 0)
                        {
                            Console.WriteLine("Skriv ID");
                            a = int.Parse(Console.ReadLine());
                        }
                        if (a != 0 && b == "")
                        {
                            Console.WriteLine("Skriv navn");
                            b = Console.ReadLine();
                        }
                    }
                    service.AddStudent(a, b);
                }
                if (myline.ToLower().Equals("edit"))
                {
                    string a = "";
                    string b = "";
                    for (int i = 0; i < 2; i++)
                    {
                        if (a != "")
                        {
                            Console.WriteLine("Skriv nyt navn");
                            b = Console.ReadLine();
                        }
                        if (a == "")
                        {
                            Console.WriteLine("Skriv navn");
                            a = Console.ReadLine();
                        }
                    }
                    service.EditStudent(a, b);
                }

                if (myline.ToLower().Equals("remove"))
                {
                    Console.WriteLine("Skriv navn på studerende du vil have fjernet");
                    service.RemoveStudent(Console.ReadLine());
                }
                if (myline.ToLower().Equals("find"))
                {
                    Console.WriteLine("Skriv navn på student du vil have vist:");
                    Console.WriteLine(service.FindStudent(int.Parse(Console.ReadLine())).ToString());
                }
                if (myline.ToLower().Equals("getall"))
                {
                    Console.WriteLine("Alle studerende:");
                    foreach (var s in service.GetAllStudents())
                    {
                        Console.WriteLine("Student:" + s);
                    }
                }
                if (myline.ToLower().Equals("stop"))
                {
                    line = "stop";
                }
            }
        }