public async Task createPublicUserProfileAsync_UserProfileCreated_SuccessfulCreation(int userId)
        {
            IDataGateway           dataGateway           = new SQLServerGateway();
            IConnectionStringData  connectionString      = new ConnectionStringData();
            IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString);

            IUserAccountRepository    userAccountRepository    = new UserAccountRepository(dataGateway, connectionString);
            IUserProfileRepository    userProfileRepository    = new UserProfileRepository(dataGateway, connectionString);
            IUserProfileService       userProfileService       = new UserProfileService(userProfileRepository);
            IUserAccountService       userAccountService       = new UserAccountService(userAccountRepository);
            IValidationService        validationService        = new ValidationService(userAccountService, userProfileService);
            IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService);

            PublicUserProfileModel model = new PublicUserProfileModel();

            model.UserId = userId;

            try
            {
                await publicUserProfileService.CeatePublicUserProfileAsync(model);

                PublicUserProfileModel profile = await publicUserProfileRepo.GetPublicProfilebyUserId(userId);

                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }
コード例 #2
0
        public async Task editPublicUserProfileAsync_EditProfile_ProfileSuccessfullyEdited(int userId, string description, string job, string goals, int age, string gender, string ethnicity, string sexualOrientation, string height, string visibility, string status, string photo, string intrests, string hobbies)
        {
            IDataGateway              dataGateway              = new SQLServerGateway();
            IConnectionStringData     connectionString         = new ConnectionStringData();
            IPublicUserProfileRepo    publicUserProfileRepo    = new PublicUserProfileRepo(dataGateway, connectionString);
            IUserAccountRepository    userAccountRepository    = new UserAccountRepository(dataGateway, connectionString);
            IUserProfileRepository    userProfileRepository    = new UserProfileRepository(dataGateway, connectionString);
            IUserProfileService       userProfileService       = new UserProfileService(userProfileRepository);
            IUserAccountService       userAccountService       = new UserAccountService(userAccountRepository);
            IValidationService        validationService        = new ValidationService(userAccountService, userProfileService);
            IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService);



            PublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfileService);



            PublicUserProfileModel model = new PublicUserProfileModel();

            model.UserId = userId;



            try
            {
                await publicUserProfileManager.CeatePublicUserProfileAsync(model);

                model.Description       = description;
                model.Jobs              = job;
                model.Goals             = goals;
                model.Age               = age;
                model.Gender            = gender;
                model.Ethnicity         = ethnicity;
                model.SexualOrientation = sexualOrientation;
                model.Height            = height;
                model.Visibility        = visibility;
                model.Status            = status;
                model.Intrests          = intrests;
                model.Hobbies           = hobbies;
                await publicUserProfileManager.EditPublicUserProfileAsync(model);

                PublicUserProfileModel profile = await publicUserProfileRepo.GetPublicProfilebyUserId(userId);

                if (profile == null)
                {
                    Assert.IsTrue(false);
                }

                if (profile.Description == description && profile.Hobbies == hobbies && profile.Jobs == job && profile.Goals == goals && profile.Age == age && profile.Gender == gender && profile.Ethnicity == ethnicity && profile.SexualOrientation == sexualOrientation && profile.Height == height && profile.Visibility == visibility && profile.Intrests == intrests)
                {
                    Assert.IsTrue(true);
                }
                else
                {
                    Assert.IsTrue(false);
                }
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }