Esempio n. 1
0
        public void ThenMyFullProfileInformationIsDisplayed()
        {
            var mocky = new Mock<IRepository<User>>();
            mocky.Setup(x => x.GetOneByName(It.IsAny<string>())).Returns(michaelBluth);

            var svc = new UserService(mocky.Object);
            var user = svc.GetProfileAsUser("michaelbluth", tobias);

            //basically make sure they have full profile access.
            Assert.AreEqual(michaelBluth.Name, user.Name);
            Assert.AreEqual(michaelBluth.Email, user.Email);
            Assert.AreEqual(michaelBluth.UserName, user.UserName);
        }
Esempio n. 2
0
        public void ThenOnlyBasicInformationIsReturned()
        {
            //mocking
            var repo = new Mock<IRepository<User>>();
            repo.Setup(x => x.GetOneByName(It.IsAny<string>())).Returns(michaelBluth);

            //only the name should be shown.
            var svc = new UserService(repo.Object);
            var user = svc.GetProfileAsUser(michaelBluth.UserName, tobias);

            Assert.IsNullOrEmpty(user.Email);
            Assert.AreEqual(0, user.Friends.Count);
            Assert.AreEqual(0, user.EventsAttending.Count);
            Assert.AreEqual(0, user.Groups.Count);
            Assert.AreEqual(0, user.Talks.Count);
            Assert.AreEqual(michaelBluth.Name, user.Name);
            Assert.AreEqual(michaelBluth.UserName, michaelBluth.UserName);
        }