Example #1
0
        public void UpdateEmployee()
        {
            MainImplementation service = new MainImplementation();
            MyEmployee         newtbl  = new MyEmployee()
            {
                Id       = 18,
                Name     = "Marios",
                Salary   = 7777,
                Birthday = new DateTime(1998, 04, 30, 13, 14, 19),
                Job      = "HR"
            };

            int result = service.UpdateEmployee(newtbl);

            //Xunit.Assert.True(result == newtbl.Id);

            //to kainoyrio tbl tha to kanw getemployeei by id
            //MyTasktbl getbyidtbl = new MyTasktbl();
            //MyTasktbl employee = service.GetEmployeeByID(1);
            //Xunit.Assert.True(employee.Exists(x => x.Id == 2));
            //Xunit.Assert.True(employee.Exists(x => x.Name.Equals("Panos")));
            //Xunit.Assert.True(employee.Exists(x => x.Salary == 7777));
            //Xunit.Assert.True(employee.Exists(x => x.Birthday ==new DateTime(1998, 04, 30, 13, 14, 19)));
            //Xunit.Assert.True(employee.Exists(x => x.Job.Equals("HR")));
        }
Example #2
0
        private static void PrintUserTree()
        {
            MainImplementation service = new MainImplementation();


            List <User> Users = service.GetUsers();

            List <Post> Posts = service.GetPosts();

            List <Comment> Comments = service.GetComments();



            foreach (var user in Users)
            {
                Console.WriteLine("The user " + user.id + " posts:");

                var postlist = Posts.Where(x => x.userId == user.id).ToList();

                foreach (var item in postlist)
                {
                    Console.WriteLine("The post is: " + item.title);

                    var commentlist = Comments.Where(f => f.postId == item.id).ToList();

                    foreach (var comment in commentlist)
                    {
                        Console.WriteLine("The comment is: " + comment.email);
                    }
                }

                Console.WriteLine("------------------------------------------------------------");
            }
        }
Example #3
0
        public void GetUsers()
        {
            MainImplementation service  = new MainImplementation();
            List <User>        userlist = service.GetUsers();

            //h lista epistrefei 10 users
            Xunit.Assert.True(userlist.Count == 10);
        }
Example #4
0
        public void GetTodos()
        {
            MainImplementation service  = new MainImplementation();
            List <Todo>        todolist = service.GetTodos();

            //h lista epistrefei 200 todos
            Xunit.Assert.True(todolist.Count == 200);
        }
Example #5
0
        public void GetPhotos()
        {
            MainImplementation service   = new MainImplementation();
            List <Photo>       photolist = service.GetPhotos();

            //h lista epistrefei 5000 photos
            Xunit.Assert.True(photolist.Count == 5000);
        }
Example #6
0
        public void GetAlbums()
        {
            MainImplementation service   = new MainImplementation();
            List <Album>       albumlist = service.GetAlbums();

            //h lista epistrefei 100 albums
            Xunit.Assert.True(albumlist.Count == 100);
        }
Example #7
0
        public void GetComments()
        {
            MainImplementation service     = new MainImplementation();
            List <Comment>     commentlist = service.GetComments();

            //h lista epistrefei 500 comments
            Xunit.Assert.True(commentlist.Count == 500);
        }
Example #8
0
        public void GetPosts()
        {
            MainImplementation service  = new MainImplementation();
            List <Post>        postlist = service.GetPosts();

            //h lista epistrefei 100 posts
            Xunit.Assert.True(postlist.Count == 100);
        }
Example #9
0
        public void GetEmployees()
        {
            MainImplementation service   = new MainImplementation();
            List <MyEmployee>  employees = service.GetEmployees();

            Xunit.Assert.NotNull(employees);
            Xunit.Assert.True(employees.Count > 0);
        }
Example #10
0
        public void GetEmployeeByID()
        {
            MainImplementation service  = new MainImplementation();
            MyEmployee         employee = service.GetEmployeeByID(1);

            Xunit.Assert.NotNull(employee);
            Xunit.Assert.True(employee.Id == 1);
            //Xunit.Assert.True(employee.Count == 1);
            //Xunit.Assert.True(employee.Exists(x => x.Id == 1));
        }
Example #11
0
        public void DeleteEmployee()
        {
            MainImplementation service = new MainImplementation();

            service.DeleteEmployee(17);

            MyEmployee employee = service.GetEmployeeByID(17);

            Xunit.Assert.Null(employee);
            //Xunit.Assert.True(employee.Count == 0);
        }
Example #12
0
        public void CreateOrUpdate()
        {
            MainImplementation service = new MainImplementation();
            var tasktbl = new MyEmployee()
            {
                Id       = 20,
                Name     = "manos",
                Salary   = 4444,
                Birthday = new DateTime(1998, 04, 30, 13, 14, 19),
                Job      = "HRrrrrrr"
            };

            service.CreateOrUpdate(tasktbl);
        }
Example #13
0
        public void CreateEmployee()
        {
            MainImplementation service = new MainImplementation();
            MyEmployee         newtbl  = new MyEmployee()
            {
                Name     = "nikos",
                Salary   = 9999,
                Birthday = new DateTime(1998, 04, 30, 13, 14, 19),
                Job      = "Hr"
            };

            int result = service.CreateEmployee(newtbl);

            Xunit.Assert.Equal(result, newtbl.Id);
        }