public void can_return_default_entity_if_not_found() { var repo = new XpoRepository(Xpo.UnitOfWork()); var item = repo.GetAndDefaultIfNotFound <XpoTestEntity, NullXpoTestEntity>(x => x.Name == "ShouldntExist"); Assert.That(item is NullXpoTestEntity); }
public void can_create_entity_if_not_found() { var repo = new XpoRepository(Xpo.UnitOfWork()); var item = repo.GetAndCreateIfNotFound <XpoTestEntity> (i => i.Name == "ShouldntExist", d => { d.Name = "New"; d.Type = "XpoTestEntity"; }); Assert.That(item != null && item.Name == "New"); }
public void can_save_to_repository() { var repo = new XpoRepository(Xpo.UnitOfWork()); var entity = repo.Create <XpoTestEntity>(); entity.Name = "Test"; entity.Type = "test"; repo.Save(); var repoItem = repo.Get <XpoTestEntity>(i => i.Name == "Test"); Assert.IsNotNull(repoItem); }
//[Test] public void test() { var part = Xpo.CreateXPObject <Fakes.FakePart>(); var consumableItem = Xpo.CreateXPObject <MaterialConsumableItem>(); var sfl = Xpo.CreateXPObject <Shopfloorline>(); consumableItem.Part = part; consumableItem.Qty = 10; consumableItem.Shopfloorline = sfl; m_unitOfWork = Xpo.UnitOfWork(); m_repository = new XpoRepository(m_unitOfWork); m_repository.Create <MaterialConsumableItem>(); m_repository.Save(); var inventory = new ServiceMaterialsInventoryController(m_unitOfWork, m_repository); var transId = inventory.Consume("FAKE", 1, 1, "Repair", ""); var item = m_repository.Find <MaterialConsumableItem>().FirstOrDefault(mci => mci.Part == part); Assert.That(item.Qty == 9); }
public void setup() { m_unitOfWork = Xpo.UnitOfWork(); }
public T CreateEntity <T>(IUnitOfWork uow) { return(Reflection.CreateInstanceOfType <T>(Xpo.UnitOfWork())); }
public XpoUnitOfWork GetUnitOfWork() { return(Xpo.UnitOfWork()); }
public void SetUp() { m_uow = Xpo.UnitOfWork(); }