public async void AddFriendRequest_AddRequestedNotAcceptedYet_NothingChanged()
        {
            Friendship friendship = new Friendship
            {
                RequesterId = member.UserId,
                Requester = member,
                ReceiverId = otherMember1.UserId,
                Receiver = otherMember1,
                RequestStatus = FriendshipRequestStatus.Pending
            };

            Mock<IVeilDataAccess> dbStub = TestHelpers.GetVeilDataAccessFake();

            Mock<DbSet<Member>> memberDbSetStub = TestHelpers.GetFakeAsyncDbSet(new List<Member> { member, otherMember1 }.AsQueryable());
            memberDbSetStub.Setup(db => db.FindAsync(member.UserId)).ReturnsAsync(member);

            Mock<DbSet<Friendship>> friendshipDbSetStub = TestHelpers.GetFakeAsyncDbSet(new List<Friendship> { friendship }.AsQueryable());
            friendshipDbSetStub.Setup(db => db.Add(It.IsAny<Friendship>())).Returns<Friendship>(i => i).Verifiable();

            dbStub.Setup(db => db.Members).Returns(memberDbSetStub.Object);
            dbStub.Setup(db => db.Friendships).Returns(friendshipDbSetStub.Object);

            Mock<ControllerContext> context = new Mock<ControllerContext>();
            context.Setup(c => c.HttpContext.User.Identity).Returns<IIdentity>(null);
            context.Setup(c => c.HttpContext.User.Identity.IsAuthenticated).Returns(true);

            Mock<IGuidUserIdGetter> idGetterStub = new Mock<IGuidUserIdGetter>();
            idGetterStub.Setup(id => id.GetUserId(It.IsAny<IIdentity>())).Returns(member.UserId);

            FriendListController controller = new FriendListController(dbStub.Object, idGetterStub.Object)
            {
                ControllerContext = context.Object
            };

            await controller.AddFriendRequest(otherMember1.UserAccount.UserName);

            Assert.That(
                () =>
                    friendshipDbSetStub.Verify(db => db.Add(It.IsAny<Friendship>()),
                    Times.Never),
                Throws.Nothing);
            Assert.That(
                () =>
                    dbStub.Verify(db => db.SaveChangesAsync(),
                    Times.Never),
                Throws.Nothing);
        }
        public async void AddFriendRequest_AddFriendIncorrectUsername_DoesntAddFriendship()
        {
            Mock<IVeilDataAccess> dbStub = TestHelpers.GetVeilDataAccessFake();

            Mock<DbSet<Member>> memberDbSetStub = TestHelpers.GetFakeAsyncDbSet(new List<Member> { member }.AsQueryable());
            memberDbSetStub.Setup(db => db.FindAsync(member.UserId)).ReturnsAsync(member);

            Mock<DbSet<Friendship>> friendshipDbSetStub = TestHelpers.GetFakeAsyncDbSet(new List<Friendship>().AsQueryable());

            dbStub.Setup(db => db.Members).Returns(memberDbSetStub.Object);
            dbStub.Setup(db => db.Friendships).Returns(friendshipDbSetStub.Object);

            Mock<ControllerContext> context = new Mock<ControllerContext>();
            context.Setup(c => c.HttpContext.User.Identity).Returns<IIdentity>(null);
            context.Setup(c => c.HttpContext.User.Identity.IsAuthenticated).Returns(true);

            Mock<IGuidUserIdGetter> idGetterStub = new Mock<IGuidUserIdGetter>();
            idGetterStub.Setup(id => id.GetUserId(It.IsAny<IIdentity>())).Returns(member.UserId);

            FriendListController controller = new FriendListController(dbStub.Object, idGetterStub.Object)
            {
                ControllerContext = context.Object
            };


            Friendship friend = new Friendship()
            {
                ReceiverId = member.UserId,
                RequesterId = otherMember1.UserId,
                RequestStatus = FriendshipRequestStatus.Pending
            };

            dbStub.Setup(db => db.Friendships.Add(friend)).Verifiable();

            //otherMember1 isn't in the mocked db
            await controller.AddFriendRequest(otherMember1.UserAccount.UserName);

            Assert.That(
                () =>
                    dbStub.Verify(db => db.Friendships.Add(friend),
                    Times.Never),
                Throws.Nothing);
        }