public void GetAllHasInDB() { List <PurchasePolicy> expected = new List <PurchasePolicy>(); expected.Add(UsernameEqualsLeaf2); expected.Add(UsernameEqualsLeaf); expected.Add(QuantityLessThanLeaf); expected.Add(QuantityGreaterThanLeaf); expected.Add(PriceLessThanLeaf); expected.Add(PriceGreaterThanLeaf); expected.Add(AddressEqualsLeaf); UsernameEqualsLeaf2.IsRoot = true; UsernameEqualsLeaf.IsRoot = true; QuantityLessThanLeaf.IsRoot = true; QuantityGreaterThanLeaf.IsRoot = true; PriceLessThanLeaf.IsRoot = true; PriceGreaterThanLeaf.IsRoot = true; AddressEqualsLeaf.IsRoot = true; datalayer.SavePolicy(UsernameEqualsLeaf2); datalayer.SavePolicy(UsernameEqualsLeaf); datalayer.SavePolicy(QuantityLessThanLeaf); datalayer.SavePolicy(QuantityGreaterThanLeaf); datalayer.SavePolicy(PriceLessThanLeaf); datalayer.SavePolicy(PriceGreaterThanLeaf); datalayer.SavePolicy(AddressEqualsLeaf); List <PurchasePolicy> found = datalayer.GetAllPolicies(); Assert.AreEqual(expected.Count, found.Count); PurchasePolicy[] foundaray = found.ToArray(); PurchasePolicy[] expectedaray = expected.ToArray(); for (int i = 0; i < expectedaray.Length; i++) { Assert.AreEqual(expectedaray[i], foundaray[i]); } }
public void SyncWithDB() { Policies = _dataLayer.GetAllPolicies(); }