public void FindAll_passes_paging_info_to_provider_and_converts_returned_collection_to_PagedListOfMembershipUser()
        {
            //arrange
            var users = new[]
                            {
                                new MembershipUser("AspNetSqlMembershipProvider", "TEST1", "", "", "", "", true, false, DateTime.Now,
                                                   DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now),
                                new MembershipUser("AspNetSqlMembershipProvider", "TEST2", "", "", "", "", true, false, DateTime.Now,
                                                   DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now)
                            };
            var usercollection = new MembershipUserCollection();
            var membership = new FakeMembershipProvider_FindAll
                             	{
                             		ReturnedUsers = usercollection,
                             		TotalRecords = 123,
                             		PageIndex = -1,
                             		PageSize = -1
                             	};
            var service = new AspNetMembershipProviderWrapper(membership);
            const int index = 3;
            const int size = 10;

            //act
            var result = service.FindAll(index, size);

            //assert
            Assert.Equal(index, membership.PageIndex);
            Assert.Equal(size, membership.PageSize);
            Assert.Equal(usercollection.Count, result.Count());
            foreach (var user in result)
                Assert.Contains(user, users);
        }
Esempio n. 2
0
        public void FindAll_passes_paging_info_to_provider_and_converts_returned_collection_to_PagedListOfMembershipUser()
        {
            //arrange
            var users = new[]
            {
                new MembershipUser("AspNetSqlMembershipProvider", "TEST1", "", "", "", "", true, false, DateTime.Now,
                                   DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now),
                new MembershipUser("AspNetSqlMembershipProvider", "TEST2", "", "", "", "", true, false, DateTime.Now,
                                   DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now)
            };
            var usercollection = new MembershipUserCollection();
            var membership     = new FakeMembershipProvider_FindAll
            {
                ReturnedUsers = usercollection,
                TotalRecords  = 123,
                PageIndex     = -1,
                PageSize      = -1
            };
            var       service    = new AspNetMembershipProviderWrapper(membership);
            const int pageNumber = 3;
            const int size       = 10;

            //act
            var result = service.FindAll(pageNumber, size);

            //assert
            Assert.Equal(pageNumber - 1, membership.PageIndex);
            Assert.Equal(size, membership.PageSize);
            Assert.Equal(usercollection.Count, result.Count());
            foreach (var user in result)
            {
                Assert.Contains(user, users);
            }
        }
Esempio n. 3
0
        public void TotalUsers_retrieves_single_user_and_returns_total_user_count()
        {
            //arrange
            const int totalRecords = 123;
            var       membership   = new FakeMembershipProvider_FindAll
            {
                TotalRecords = totalRecords,
                PageIndex    = -1,
                PageSize     = -1
            };
            var service = new AspNetMembershipProviderWrapper(membership);

            //act
            var result = service.TotalUsers;

            //assert
            Assert.Equal(1, membership.PageIndex);
            Assert.Equal(1, membership.PageSize);
            Assert.Equal(totalRecords, result);
        }
        public void TotalUsers_retrieves_single_user_and_returns_total_user_count()
        {
            //arrange
            const int totalRecords = 123;
            var membership = new FakeMembershipProvider_FindAll
                             	{
                             		TotalRecords = totalRecords,
                             		PageIndex = -1,
                             		PageSize = -1
                             	};
            var service = new AspNetMembershipProviderWrapper(membership);

            //act
            var result = service.TotalUsers;

            //assert
            Assert.Equal(1, membership.PageIndex);
            Assert.Equal(1, membership.PageSize);
            Assert.Equal(totalRecords, result);
        }