public async Task TestGetAll() { try { IEnumerable <Party> ans = await PartyService.GetAll(Context); //Assert.AreEqual(6, ans.Count(n => n.Active), "Expected 6 active parties in test dataset."); Assert.AreEqual("Democratic Party", ans.SingleOrDefault(n => n.Id == 1 && n.Active).Description, "Expected Id: 1 to be 'Democratic Party' and active"); Assert.AreEqual("Republican Party", ans.SingleOrDefault(n => n.Id == 2 && n.Active).Description, "Expected Id: 2 to be 'Republican Party' and active"); Assert.AreEqual("Libertarian Party", ans.SingleOrDefault(n => n.Id == 3 && n.Active).Description, "Expected Id: 3to be 'Libertarian Party' and active"); Assert.AreEqual("Green Party", ans.SingleOrDefault(n => n.Id == 4 && n.Active).Description, "Expected Id: 4 to be 'Green Party' and active"); Assert.AreEqual("Socialism and Liberation Party", ans.SingleOrDefault(n => n.Id == 5 && n.Active).Description, "Expected Id: 5 to be 'Socialism and Liberation Party' and active"); Assert.AreEqual("Socialist Workers Party", ans.SingleOrDefault(n => n.Id == 6 && n.Active).Description, "Expected Id: 6 to be 'Socialist Workers Party' and active"); } catch (Exception ex) { Assert.IsNull(ex, "Exception Thrown: " + ex.Message); } }
public ActionResult GetAll() { type.GetAll(); return(View()); }
public IEnumerable <PartyViewModel> GetAll(string name, bool withMembers = false, bool withActiveMembers = false) { return(_partyService.GetAll(name, withMembers, withActiveMembers).Result); }