public async Task Index_passes_RequestSent_to_ViewBag(bool RequestSent) { var userId = "foxyboots9-guid"; var mockDbContext = new MockContext(); var controller = new FriendshipsController(mockDbContext.Object, () => userId); var result = await controller.Index(RequestSent) as ViewResult; Assert.IsNotNull(result); Assert.AreEqual(RequestSent, result.ViewBag.RequestSent); }
public async Task Index_returns_logged_in_Users_Friendships_in_View() { var userId = "foxyboots9-guid"; var mockDbContext = new MockContext(); var controller = new FriendshipsController(mockDbContext.Object, () => userId); var result = await controller.Index() as ViewResult; Assert.IsNotNull(result); var model = result.Model as IEnumerable <FriendshipWithNames>; Assert.IsNotNull(model); foreach (var friendship in model) { Assert.That(friendship.FriendId == userId || friendship.UserId == userId); } }