public async Task editUserProfilePicture_EditPhoto_PhotoSuccessfullyEdited(int userId, string photo)
        {
            Mock <IPublicUserProfileService> publicUserProfilervice   = new Mock <IPublicUserProfileService>();
            IPublicUserProfileManager        publicUserProfileManager = new PublicUserProfileManager(publicUserProfilervice.Object);

            PublicUserProfileModel model = new PublicUserProfileModel();


            try
            {
                model.UserId = userId;

                await publicUserProfileManager.CeatePublicUserProfileAsync(model);


                model.Photo = photo;


                await publicUserProfileManager.EditUserProfilePictureAsync(model);

                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 2
0
        public async Task editUserProfilePicture_EditPhoto_PhotoSuccessfullyEdited(int userId, string photo)
        {
            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();


            try
            {
                model.UserId = userId;
                await publicUserProfileManager.CeatePublicUserProfileAsync(model);

                model.Photo = photo;
                await publicUserProfileManager.EditUserProfilePictureAsync(model);

                IEnumerable <PublicUserProfileModel> models = await publicUserProfileRepo.GetAllPublicProfiles();

                if (models == null)
                {
                    Assert.IsTrue(false);
                }
                if (models.Count() == 0)
                {
                    Assert.IsTrue(false);
                }
                foreach (var profile in models)
                {
                    if (profile.Photo == photo)
                    {
                        Assert.IsTrue(true);
                    }
                    else
                    {
                        Assert.IsTrue(false);
                    }
                }
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }