public void DeleteConfirmed_throws_BadRequest_if_either_User_not_passed(string userId, string friendId)
        {
            var mockDbContext = new MockContext();
            var controller    = new FriendshipsController(mockDbContext.Object, () => userId);

            var httpException = Assert.ThrowsAsync <HttpException>(async() => await controller.DeleteConfirmed(userId, friendId));

            Assert.That(httpException.GetHttpCode(), Is.EqualTo((int)HttpStatusCode.BadRequest));

            mockDbContext.MockFriendships.Verify(m => m.Remove(It.IsAny <Friendship>()), Times.Never());
            mockDbContext.Verify(m => m.SaveChangesAsync(), Times.Never());
        }
        public async Task DeleteConfirmed_redirects_to_Index_if_valid(string userId, string friendId)
        {
            var mockDbContext = new MockContext();
            var controller    = new FriendshipsController(mockDbContext.Object, () => userId);

            var result = await controller.DeleteConfirmed(userId, friendId) as RedirectToRouteResult;

            Assert.IsNotNull(result);
            Assert.AreEqual("Index", result.RouteValues["action"]);

            mockDbContext.MockFriendships.Verify(m => m.Remove(It.IsAny <Friendship>()), Times.AtLeastOnce());
            mockDbContext.Verify(m => m.SaveChangesAsync(), Times.AtLeastOnce());
        }
        public void DeleteConfirmed_throws_Forbidden_if_User_not_in_Friendship()
        {
            var userId        = "robcory-guid";
            var mockDbContext = new MockContext();
            var controller    = new FriendshipsController(mockDbContext.Object, () => userId);

            var httpException = Assert.ThrowsAsync <HttpException>(async() => await controller.DeleteConfirmed("foxyboots9-guid", "coryhome-guid"));

            Assert.That(httpException.GetHttpCode(), Is.EqualTo((int)HttpStatusCode.Forbidden));

            mockDbContext.MockFriendships.Verify(m => m.Remove(It.IsAny <Friendship>()), Times.Never());
            mockDbContext.Verify(m => m.SaveChangesAsync(), Times.Never());
        }
        public void DeleteConfirmed_throws_NotFound_if_Users_not_connected()
        {
            var userId        = "coryhome-guid";
            var friendId      = "robcory-guid";
            var mockDbContext = new MockContext();
            var controller    = new FriendshipsController(mockDbContext.Object, () => userId);

            var httpException = Assert.ThrowsAsync <HttpException>(async() => await controller.DeleteConfirmed(userId, friendId));

            Assert.That(httpException.GetHttpCode(), Is.EqualTo((int)HttpStatusCode.NotFound));

            mockDbContext.MockFriendships.Verify(m => m.Remove(It.IsAny <Friendship>()), Times.Never());
            mockDbContext.Verify(m => m.SaveChangesAsync(), Times.Never());
        }