Beispiel #1
0
        public void GetUser_ForValidUser_ReturnsMembershipData()
        {
            List <UserProfile>             userProfiles      = CommonData.GetUserProfiles();
            List <WebpagesOauthMembership> allMembershipData = CommonData.GetOAuthMembershipData();

            string providerUserKey = allMembershipData.ElementAt(0) != null?allMembershipData.ElementAt(0).RowKey : null;

            MembershipUser expectedMembershipUserData = new MembershipUser(
                allMembershipData.ElementAt(0).Provider,
                userProfiles.ElementAt(0).UserName,
                providerUserKey,
                userProfiles.ElementAt(0).PreferredEmail,
                string.Empty,
                string.Empty,
                true,
                false,
                userProfiles.ElementAt(0).Timestamp.LocalDateTime,
                DateTime.MinValue,
                DateTime.MinValue,
                DateTime.MinValue,
                DateTime.MinValue);

            this.userManager.GetAllUserProfiles       = () => userProfiles;
            this.userManager.GetMemshipDataofAllUsers = () => allMembershipData;

            MembershipUser actualMembershipUserData = this.azureMembershipProvider.GetUser(userProfiles.ElementAt(0).UserName, false);

            CustomAssert.AreEqualByProperties(expectedMembershipUserData, actualMembershipUserData, CommonConstants.MembershipParametersName);
        }
Beispiel #2
0
        public void GetMembershipFromProvider_ForCorrectProvider_ReturnsCorrectMembershipData()
        {
            WebpagesOauthMembership expectedWebpagesOauthMembershipData = CommonData.GetOAuthMembershipData().ElementAt(0);

            WebpagesOauthMembership actualWebpagesOauthMembershipData = UserManager.GetMembershipFromProvider(expectedWebpagesOauthMembershipData.Provider, expectedWebpagesOauthMembershipData.UserId.ToString());

            CustomAssert.AreEqualByProperties(expectedWebpagesOauthMembershipData, actualWebpagesOauthMembershipData, CommonConstants.MembershipInfoParamList);
        }
Beispiel #3
0
        public void GetUserProfileFromUserId_ForValidUserId_ReturnsUserProfile()
        {
            UserProfile userProfile = CommonData.GetUserProfiles().ElementAt(0);

            this.azureTableOperation.FetchEntityOf1StringStringString <UserProfile>((partitionKey, rowKey, tableName) => userProfile);

            UserProfile actualUserProfile = this.userManager.GetUserProfileFromUserId(userProfile.RowKey);

            CustomAssert.AreEqualByProperties(userProfile, actualUserProfile, CommonConstants.UserInfoParamList);
        }
Beispiel #4
0
        public void GetMembershipFromProvider_ForCorrectProvider_ReturnsCorrectMembershipData()
        {
            WebpagesOauthMembership expectedMembershipData = CommonData.GetOAuthMembershipData().ElementAt(0);

            this.azureTableOperation.FetchEntityOf1StringStringString <WebpagesOauthMembership>((partitionKey, rowKey, tableName) => expectedMembershipData);

            WebpagesOauthMembership actualMembershipData = this.userManager.GetMembershipFromProvider(expectedMembershipData.Provider, expectedMembershipData.UserId.ToString());

            CustomAssert.AreEqualByProperties(expectedMembershipData, actualMembershipData, CommonConstants.MembershipInfoParamList);
        }
Beispiel #5
0
        public void GetUserAndAccessDetailsByUserId_ForValidUserId_ReturnsCorrectUserDetails()
        {
            List <UserDetails> userDetailsList   = CommonData.GetUserDetails();
            UserDetails        actualUserDetails = UserManager.GetUserAndAccessDetailsByUserId(userProfileEntities.ElementAt(0).RowKey);

            CustomAssert.AreEqualByProperties(userDetailsList.ElementAt(0).UserInfo, actualUserDetails.UserInfo, CommonConstants.UserInfoParamList);

            for (int i = 0; i < actualUserDetails.AccessInfo.Count(); i++)
            {
                CustomAssert.AreEqualByProperties(userDetailsList.ElementAt(0).AccessInfo.ElementAt(i), actualUserDetails.AccessInfo.ElementAt(i), CommonConstants.AccessInfoParamList);
            }
        }
Beispiel #6
0
        public void GetUserProfileFromProvider_ForCorrectProvider_ReturnsCorrectUserProfile()
        {
            UserProfile             expectedUserProfile = CommonData.GetUserProfiles().ElementAt(0);
            WebpagesOauthMembership membershipData      = CommonData.GetOAuthMembershipData().ElementAt(0);

            this.azureTableOperation.FetchEntityOf1StringStringString <WebpagesOauthMembership>((partitionKey, rowKey, tableName) => membershipData);
            this.azureTableOperation.FetchEntityOf1StringStringString <UserProfile>((partitionKey, rowKey, tableName) => expectedUserProfile);

            UserProfile actualUserProfile = this.userManager.GetUserProfileFromProvider(membershipData.Provider, membershipData.UserId.ToString());

            CustomAssert.AreEqualByProperties(expectedUserProfile, actualUserProfile, CommonConstants.UserInfoParamList);
        }
        public void Test_FetchEntity_method()
        {
            UserProfile entity = CommonData.GetUserProfiles().ElementAt(0);

            this.cloudTable = this.cloudTableClient.GetTableReference(CommonConstants.UserProfileTable);
            TableOperation insertOperation = TableOperation.InsertOrReplace(entity);

            this.cloudTable.Execute(insertOperation);

            UserProfile actualTableEntity = this.azureTableOperation.FetchEntity <UserProfile>(entity.PartitionKey, entity.RowKey);

            CustomAssert.AreEqualByProperties(entity, actualTableEntity, CommonConstants.UserInfoParamList);

            this.DeleteEntity(CommonConstants.UserProfileTable, entity);
        }
        public void Test_InsertEntity_method()
        {
            UserProfile entity = CommonData.GetUserProfiles().ElementAt(0);

            this.azureTableOperation.InsertEntity(entity);

            TableOperation retrieveOperation = TableOperation.Retrieve <UserProfile>(entity.PartitionKey, entity.RowKey);

            this.cloudTable = this.cloudTableClient.GetTableReference(CommonConstants.UserProfileTable);
            TableResult retrievedResult = this.cloudTable.Execute(retrieveOperation);

            CustomAssert.AreEqualByProperties(entity, retrievedResult.Result as UserProfile, CommonConstants.UserInfoParamList);

            this.DeleteEntity(CommonConstants.UserProfileTable, entity);
        }
        public void GetULSFileInfo_ValidULSFileNumber_ReturnsULSFileInfo()
        {
            string[]         ulsFileInfoParameters = new[] { "GrantDate", "ExpireDate", "Latitude", "Longitude", "ContactEmail", "ContactZipCode", "ContactEntityName" };
            LpAuxLicenseInfo actualULSFileInfo     = this.whitespacesManager.GetULSFileInfo("0005122780");

            LpAuxLicenseInfo expectedULSFileInfo = new LpAuxLicenseInfo
            {
                GrantDate         = Convert.ToDateTime("4/2/2012 5:30:00 AM +05:30"),
                ExpireDate        = Convert.ToDateTime("4/2/2015 5:30:00 AM +05:30"),
                Latitude          = 39.99077777777778,
                Longitude         = -76.76466666666667,
                ContactEmail      = "*****@*****.**",
                ContactZipCode    = "17325",
                ContactEntityName = "FCC Test 004"
            };

            CustomAssert.AreEqualByProperties(expectedULSFileInfo, actualULSFileInfo, ulsFileInfoParameters);
        }
Beispiel #10
0
        public void GetUserAndAccessDetailsByUserId_ForValidUserId_ReturnsCorrectUserDetails()
        {
            UserProfile            userProfile         = CommonData.GetUserProfiles().ElementAt(0);
            UserDetails            expectedUserDetails = CommonData.GetUserDetails().ElementAt(0);
            List <AuthorityAccess> authorityAccessData = CommonData.GetAuthorityAccessData();

            this.azureTableOperation.FetchEntityOf1StringStringString <UserProfile>((partitionKey, rowKey, tableName) => userProfile);
            this.azureTableOperation.GetEntityByPartitionKeyOf1String <AuthorityAccess>((partitionKey) => authorityAccessData);

            UserDetails actualUserDetails = this.userManager.GetUserAndAccessDetailsByUserId(userProfile.RowKey);

            CustomAssert.AreEqualByProperties(expectedUserDetails.UserInfo, actualUserDetails.UserInfo, CommonConstants.UserInfoParamList);

            for (int i = 0; i < expectedUserDetails.AccessInfo.Count(); i++)
            {
                CustomAssert.AreEqualByProperties(expectedUserDetails.AccessInfo.ElementAt(i), actualUserDetails.AccessInfo.ElementAt(i), CommonConstants.AccessInfoParamList);
            }
        }
Beispiel #11
0
        public void GetUserDetailsByProviderUserId_ForValidProviderId_ReturnsCorrectUserDetails()
        {
            WebpagesOauthMembership webpagesOauthMembershipData      = CommonData.GetOAuthMembershipData().ElementAt(0);
            List <UserDetails>      userDetailsWithoutMembershipInfo = CommonData.GetUserDetails();

            foreach (UserDetails detail in userDetailsWithoutMembershipInfo)
            {
                detail.MembershipInfo = webpagesOauthMembershipData;
            }

            UserDetails expectedUserDetails = userDetailsWithoutMembershipInfo.ElementAt(0);
            UserDetails actualUserDetails   = UserManager.GetUserDetailsByProviderUserId(expectedUserDetails.MembershipInfo.UserId.ToString());

            CustomAssert.AreEqualByProperties(expectedUserDetails.UserInfo, actualUserDetails.UserInfo, CommonConstants.UserInfoParamList);
            CustomAssert.AreEqualByProperties(expectedUserDetails.MembershipInfo, actualUserDetails.MembershipInfo, CommonConstants.MembershipInfoParamList);

            for (int i = 0; i < actualUserDetails.AccessInfo.Count(); i++)
            {
                CustomAssert.AreEqualByProperties(expectedUserDetails.AccessInfo.ElementAt(i), actualUserDetails.AccessInfo.ElementAt(i), CommonConstants.AccessInfoParamList);
            }
        }
        public void Test_GetEntityByPartitionKey_method()
        {
            UserProfile entity = CommonData.GetUserProfiles().ElementAt(0);

            this.cloudTable = this.cloudTableClient.GetTableReference(CommonConstants.UserProfileTable);
            TableOperation insertOperation = TableOperation.InsertOrReplace(entity);

            this.cloudTable.Execute(insertOperation);

            IEnumerable <UserProfile> actualEntities = this.azureTableOperation.GetEntityByPartitionKey <UserProfile>(entity.PartitionKey);

            foreach (UserProfile user in actualEntities)
            {
                if (string.Compare(entity.RowKey, user.RowKey, true) == 0)
                {
                    CustomAssert.AreEqualByProperties(entity, user);
                    break;
                }
            }

            this.DeleteEntity(CommonConstants.UserProfileTable, entity);
        }
Beispiel #13
0
        public void GetUserDetailsByProviderUserId_ForValidProviderId_ReturnsCorrectUserDetails()
        {
            WebpagesOauthMembership webpagesOauthMembershipData = CommonData.GetOAuthMembershipData().ElementAt(0);
            UserProfile             userProfile = CommonData.GetUserProfiles().ElementAt(0);
            UserDetails             userDetails = CommonData.GetUserDetails().ElementAt(0);

            userDetails.MembershipInfo = webpagesOauthMembershipData;

            List <AuthorityAccess> authorityAccessData = CommonData.GetAuthorityAccessData();

            this.azureTableOperation.FetchEntityOf1StringStringString <WebpagesOauthMembership>((partitionKey, rowKey, tableName) => webpagesOauthMembershipData);
            this.azureTableOperation.FetchEntityOf1StringStringString <UserProfile>((partitionKey, rowKey, tableName) => userProfile);
            this.azureTableOperation.GetEntityByPartitionKeyOf1String <AuthorityAccess>((partitionKey) => authorityAccessData);

            UserDetails actualUserDetails = this.userManager.GetUserDetailsByProviderUserId(userDetails.MembershipInfo.RowKey);

            CustomAssert.AreEqualByProperties(userDetails.UserInfo, actualUserDetails.UserInfo, CommonConstants.UserInfoParamList);
            CustomAssert.AreEqualByProperties(userDetails.MembershipInfo, actualUserDetails.MembershipInfo, CommonConstants.MembershipInfoParamList);

            for (int i = 0; i < userDetails.AccessInfo.Count(); i++)
            {
                CustomAssert.AreEqualByProperties(userDetails.AccessInfo.ElementAt(i), actualUserDetails.AccessInfo.ElementAt(i), CommonConstants.AccessInfoParamList);
            }
        }
Beispiel #14
0
        public void GetUserProfileFromProvider_ForCorrectProvider_ReturnsCorrectUserProfile()
        {
            UserProfile actualUserProfile = UserManager.GetUserProfileFromProvider(CommonConstants.Provider, userProfileEntities.ElementAt(0).RowKey);

            CustomAssert.AreEqualByProperties(userProfileEntities.ElementAt(0), actualUserProfile, CommonConstants.UserInfoParamList);
        }