Exemplo n.º 1
0
        public async Task TestGetAll()
        {
            try
            {
                IEnumerable <Party> ans = await partyRepository.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);
            }
        }
Exemplo n.º 2
0
 public List <Party> GetFirst10Parties()
 {
     return(PartyRepository.GetAll().OrderByDescending(x => x.Date).Take(10).ToList());
 }
Exemplo n.º 3
0
 public List <Party> GetAdultParties()
 {
     return(PartyRepository.GetAll().Where(x => x.IsPlus18).ToList());
 }
Exemplo n.º 4
0
 public List <Party> GetIncomingParties()
 {
     return(PartyRepository.GetAll());
 }
Exemplo n.º 5
0
 public List <Party> GetAll(bool withDeleted = false)
 {
     return(repository.GetAll(withDeleted));
 }