public void DeleteFriendViaRepository()
        {
            var mockFriendRepository = Mock.Create<IFriendRepository>();
            var mockNotificationService = Mock.Create<INotificationService>();

            var myFriendsService = new FriendsService(mockFriendRepository, mockNotificationService);

            myFriendsService.DeleteFriend(0);

            Mock.Assert(() => mockFriendRepository.Delete(Arg.IsAny<int>()), Occurs.Once());
        }
        public void CreateFriendAndSendNotification()
        {
            var mockFriendRepository = Mock.Create<IFriendRepository>();
            var mockNotificationService = Mock.Create<INotificationService>();

            var myFriendsService = new FriendsService(mockFriendRepository, mockNotificationService);

            myFriendsService.AddFriend(Guid.NewGuid(), "", "", "");

            Mock.Assert(() => mockFriendRepository.Create(Arg.IsAny<Guid>(), Arg.IsAny<string>()), Occurs.Once());
            Mock.Assert(() => mockNotificationService.SendNotification(Arg.IsAny<string>(), Arg.IsAny<string>(), Arg.IsAny<string>()), Occurs.Once());
        }
        public void ReturnListFromRepository()
        {
            var mockFriendRepository = Mock.Create<IFriendRepository>();
            var mockNotificationService = Mock.Create<INotificationService>();

            var myFriendsService = new FriendsService(mockFriendRepository, mockNotificationService);

            var result = myFriendsService.ListFriendsOf(Guid.NewGuid());

            Mock.Assert(() => mockFriendRepository.ListFriendsOfUser(Arg.IsAny<Guid>()), Occurs.Once());
            Assert.IsInstanceOfType(result, typeof(IEnumerable<Friend>));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string currentUserName = MyProfile.CurrentUser.Name;
            string currentUserEmail = SecurityMembership.GetUser().Email;
            string friendEmail = Request.QueryString["email"];
            Guid currentUserId = (Guid)SecurityMembership.GetUser().ProviderUserKey;

            var friendsService = new FriendsService(new EfFriendRepository(),
                new NotificationService(new EfQueryUsersByEmail(), new DebugEmailSender()));

            friendsService.AddFriend(currentUserId, currentUserEmail, currentUserName, friendEmail);

            SuccessLabel.Text = "Added friend: " + Request.QueryString["email"];
        }
        public void AddFriendWithValidEmail()
        {
            // arrange
            string currentUserName = "******";
            string currentUserEmail = "*****@*****.**";
            string friendEmail = "*****@*****.**";
            Guid currentUserId = new Guid("EEECAA7B-57D5-45E1-AF11-6EBACCAC4117");

            // act
            var friendsService = new FriendsService(new FakeFriendRepository(),
                new NotificationService(new FakeQueryUsersByEmail(), new FakeEmailSender()));

            friendsService.AddFriend(currentUserId, currentUserEmail, currentUserName, friendEmail);

            // assert
        }