コード例 #1
0
        public void CanCreateNewFriend()
        {
            Guid testUserId;

            using (var context = new aspnetdbEntities())
            {
                testUserId = context.aspnet_Membership.FirstOrDefault().UserId;
            }

            var friend = ActiveRecordFriend.CreateNew("*****@*****.**", testUserId);

            Assert.IsNotNull(friend);
        }
コード例 #2
0
        public void CanCreateExistingFriend()
        {
            Guid testUserId;
            using (var context = new Entities())
            {
                testUserId = context.Memberships.FirstOrDefault().UserId;
            }
            var friend = ActiveRecordFriend.CreateNew("*****@*****.**", testUserId);

            var secondFriend = new ActiveRecordFriend(friend.Id);

            Assert.IsNotNull(secondFriend);
        }
コード例 #3
0
        public void EmailDomainReturnedCorrectly()
        {
            Guid testUserId;

            using (var context = new aspnetdbEntities())
            {
                testUserId = context.aspnet_Membership.FirstOrDefault().UserId;
            }
            var friend = ActiveRecordFriend.CreateNew("*****@*****.**", testUserId);

            var domain = friend.EmailDomain;

            Assert.AreEqual("foo.com", domain);
        }
コード例 #4
0
        public void CanSaveChangesToFriend()
        {
            Guid testUserId;
            using (var context = new Entities())
            {
                testUserId = context.Memberships.FirstOrDefault().UserId;
            }
            var friend = ActiveRecordFriend.CreateNew("*****@*****.**", testUserId);

            var secondFriend = new ActiveRecordFriend(friend.Id);
            secondFriend.EmailAddress = "updated";
            secondFriend.Save();

            var thirdFriend = new ActiveRecordFriend(friend.Id);

            Assert.AreEqual(secondFriend.EmailAddress, thirdFriend.EmailAddress);
        }
コード例 #5
0
        public void CanSaveChangesToFriend()
        {
            Guid testUserId;

            using (var context = new aspnetdbEntities())
            {
                testUserId = context.aspnet_Membership.FirstOrDefault().UserId;
            }
            var friend = ActiveRecordFriend.CreateNew("*****@*****.**", testUserId);

            var secondFriend = new ActiveRecordFriend(friend.Id);

            secondFriend.EmailAddress = "updated";
            secondFriend.Save();

            var thirdFriend = new ActiveRecordFriend(friend.Id);

            Assert.AreEqual(friend.EmailAddress, thirdFriend.EmailAddress);
        }