public void Can_update_user()
        {
            // Assign
            const string dbName = "Can_update_user";
            var          user   = Initializers.DefaultUser;

            using (var context = Initializers.FakeContext(dbName)){
                var service = Initializers.FakeUserService(context);
                //user = service.CreateAsync(user).Result;
            }

            // Action
            user.FirstName = "new first name";
            user.LastName  = "new last name";
            //user.ImageUrl = "new image url";
            user.Email = "*****@*****.**";
            UserDto updatedUser;

            using (var context = Initializers.FakeContext(dbName)){
                var service = Initializers.FakeUserService(context);
                updatedUser = service.UpdateProfileAsync(user).Result;
            }

            // Assert
            Assert.Equal(user.Email, updatedUser.Email);
            Assert.Equal(user.LastName, updatedUser.LastName);
            Assert.Equal(user.FirstName, updatedUser.FirstName);
            //Assert.Equal(user.ImageUrl, updatedUser.ImageUrl);
        }
        public void Can_update_employee_profile()
        {
            // Assign
            var employeeProfile = Initializers.DefaultEmployeeProfile;
            const string dbName = "Can_update_employee_profile";
            using (var context = Initializers.FakeContext(dbName))
            {
                var userService = Initializers.FakeUserService(context);
                //userService.CreateAsync(employeeProfile.User).Wait();
                var employeeService = Initializers.FakeEmployeeService(context);
                //employeeProfile.Id = employeeService.CreateEmployeeAsync(employeeProfile).Result.Id;
            }

            // Action
            employeeProfile.ServiceType = "top";
            employeeProfile.ServiceCost = 10;
            employeeProfile.Description = "best+test";
            EmployeeProfileDto result;
            using(var context = Initializers.FakeContext(dbName)){
                var employeeService = Initializers.FakeEmployeeService(context);
                //result = employeeService.UpdateEmployeeAsync(employeeProfile).Result;
            }

            // Assert
            //Assert.Equal(employeeProfile.ServiceType, result.ServiceType);
            //Assert.Equal(employeeProfile.ServiceCost, result.ServiceCost);
            //Assert.Equal(employeeProfile.Description, result.Description);
        }
        public void Can_create_user()
        {
            // Assign
            var user = Initializers.DefaultUser;

            using var context = Initializers.FakeContext("Can_create_user");

            // Action
            var service = Initializers.FakeUserService(context);
            //var createdUser = service.CreateAsync(user).Result;

            // Assert
            //Assert.Equal(user.Email, createdUser.Email);
            //Assert.Equal("user", createdUser.Role);
        }
        public void Can_auth_user()
        {
            // Assign
            var user = Initializers.DefaultUser;

            using var context = Initializers.FakeContext("Can_auth_user");

            // Action
            var service = Initializers.FakeUserService(context);
            //service.CreateAsync(user).Wait();
            // var createdUser = service.AuthenticateAsync(user).Result;

            // Assert
            //Assert.NotNull(createdUser.Token);
        }
        public void Can_delete_employee_profile()
        {
            // Assign
            const string dbName = "Can_delete_employee_profile";
            var employeeProfile = Initializers.DefaultEmployeeProfile;
            using var context = Initializers.FakeContext(dbName);
            var userService = Initializers.FakeUserService(context);
            //userService.CreateAsync(employeeProfile.User).Wait();
            var employeeService = Initializers.FakeEmployeeService(context);
            //employeeProfile.Id = employeeService.CreateEmployeeAsync(employeeProfile).Result.Id;

            // Action
            var result = employeeService.DeleteEmployeeAsync(employeeProfile.Id).Result;

            // Assert
            // No exceptions
            Assert.Equal(employeeProfile.Id, result.Id);
        }
        public void Can_create_employee_profile()
        {
            // Assign
            var dbName = "Can_create_employee_profile";
            var employeeDto = Initializers.DefaultEmployeeProfile;
            using var context = Initializers.FakeContext(dbName);
            var userService = Initializers.FakeUserService(context);
            var employeeService = Initializers.FakeEmployeeService(context);
            //employeeDto.User.Id = userService.SignUpAsync(employeeDto.User).Result.Id;
            
            // Action
            //var result = employeeService.CreateEmployeeAsync(employeeDto).Result;

            // Assert
            //Assert.Equal(employeeDto.Description, result.Description);
            //Assert.Equal(employeeDto.User.Id, result.User.Id);
            //Assert.Equal(employeeDto.ServiceCost, result.ServiceCost);
            //Assert.Equal(employeeDto.ServiceType.ToLower(), result.ServiceType);
        }
        public async void Can_create_order()
        {
            // Assign
            await using var context = Initializers.FakeContext("Can_create_order");
            var userService     = Initializers.FakeUserService(context);
            var employeeService = Initializers.FakeEmployeeService(context);
            var orderService    = Initializers.FakeOrderService(context);
            var employee        = Initializers.DefaultEmployeeProfile;
            var client          = Initializers.DefaultUser;

            client.Email = "*****@*****.**";
            //client = await userService.CreateAsync(client);
            //employee.User = await userService.CreateAsync(employee.User);
            //employee.UserId = employee.User.Id.Value;
            //employee = await employeeService.CreateEmployeeAsync(employee);

            // Action
            var order = new OrderDto
            {
                Address   = "ffd",
                BriefTask = "l",
                //ClientId = client.Id.Value,
                EmployeeId     = employee.Id,
                ContactPhone   = "124",
                Date           = DateTime.Now,
                Price          = 12m,
                ServiceDetails = "d"
            };
            var createdOrder = await orderService.CreateAsync(order);

            // Assert
            Assert.Equal(OrderStatus.WaitingForEmployee, createdOrder.Status);
            Assert.Equal(order.Address, createdOrder.Address);
            Assert.Equal(order.BriefTask, createdOrder.BriefTask);
            Assert.Equal(order.ServiceDetails, createdOrder.ServiceDetails);
            Assert.Equal(order.Date, createdOrder.Date);
            Assert.Equal(order.ContactPhone, createdOrder.ContactPhone);
            Assert.Equal(order.Price, createdOrder.Price);
        }
        public async void Can_not_create_user_with_same_email()
        {
            // Assign
            using var context = Initializers.FakeContext("Can_not_create_user_with_same_email");
            var user          = Initializers.DefaultUser;
            var sameEmailUser = new UserDto
            {
                FirstName = "tes",
                LastName  = "sss",
                //Password = "******",
                PhoneNumber = "+121137890",
                Role        = "user",
                Email       = user.Email
            };

            // Assert
            await Assert.ThrowsAsync <LogicException>(async() => {
                var service = Initializers.FakeUserService(context);
                //await service.CreateAsync(user);
                //await service.CreateAsync(sameEmailUser);
            });
        }