public void CanCreateNewFriend()
        {
            Guid testUserId;

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

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

            Assert.IsNotNull(friend);
        }
Ejemplo n.º 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);
        }
        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);
        }
Ejemplo n.º 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);
        }
        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);
        }