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)
        {
            Mock <IPublicUserProfileService> publicUserProfilervice   = new Mock <IPublicUserProfileService>();
            IPublicUserProfileManager        publicUserProfileManager = new PublicUserProfileManager(publicUserProfilervice.Object);

            PublicUserProfileModel model = new PublicUserProfileModel();

            model.UserId = userId;

            await publicUserProfileManager.CeatePublicUserProfileAsync(model);

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

                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }
示例#2
0
        public async Task GetUserProfile_GetsProfile_ProfileGetSuccess(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.Status            = status;
                model.Photo             = photo;
                model.Intrests          = intrests;
                model.Hobbies           = hobbies;

                await publicUserProfileManager.EditPublicUserProfileAsync(model);


                PublicUserProfileModel profile = await publicUserProfileManager.GetUserProfileAsync(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);
            }
        }