public void CanAddPlan() { var provider = new PersistentPlanStorage(null); var cache = new PlanCache(new ExpirationStrategyMock()); var repository = new PlanRepository(new PlanStorage(cache, provider)); var plan = GenerateTestPlan(); repository.Add(plan); repository.SaveChanges(); var loadedPlan = provider.LoadPlan(Guid.Empty); AssertEquals(plan, loadedPlan); AssertEquals(plan, repository.GetById <PlanDO>(NewGuid(13))); }
public void CanAddPlanWithEmptyDefaultIds() { var provider = new PersistentPlanStorage(null); var cache = new PlanCache(new ExpirationStrategyMock()); var repository = new PlanRepository(new PlanStorage(cache, provider)); var refPlan = GenerateTestPlan(); PlanTreeHelper.Visit(refPlan, x => x.Id = Guid.Empty); repository.Add(refPlan); repository.SaveChanges(); PlanTreeHelper.Visit(refPlan, x => Assert.IsTrue(x.Id != Guid.Empty)); var loadedPlan = provider.LoadPlan(Guid.Empty); AssertEquals(refPlan, loadedPlan); }