public async Task cListPickups() { ActionResult <IEnumerable <Pickup> > actionresult = await _controller.GetPickup(); List <Pickup> pkups = ((List <Pickup>)actionresult.Value); if (pkups.Count == 2) { Assert.Pass(); } else { Assert.Fail(); } }
public void Get_EndGameSession_with_id_4_returns_EndGameSession_object_with_id_4() { var data = new List <Pickup> { GetTestPickup(), }.AsQueryable(); Mock <PGDbContext> context = GetTestPickupContext(data); var controller = new PickupsController(context.Object); IHttpActionResult response = controller.GetPickup(1); Assert.IsInstanceOfType(response, typeof(OkNegotiatedContentResult <Pickup>), "GetPickup should return OK with Pickup data"); OkNegotiatedContentResult <Pickup> responseWithData = (OkNegotiatedContentResult <Pickup>)response; Assert.IsNotNull(responseWithData.Content, "Pickup data that was fetched with Get should not be null"); Assert.AreEqual(1, responseWithData.Content.PickupId, "Pickup data ID should be 1"); }