Пример #1
0
        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);
        }
Пример #2
0
        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");
        }
Пример #3
0
        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);
        }
Пример #4
0
        //[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);
        }
Пример #5
0
 public void setup()
 {
     m_unitOfWork = Xpo.UnitOfWork();
 }
Пример #6
0
 public T CreateEntity <T>(IUnitOfWork uow)
 {
     return(Reflection.CreateInstanceOfType <T>(Xpo.UnitOfWork()));
 }
Пример #7
0
 public XpoUnitOfWork GetUnitOfWork()
 {
     return(Xpo.UnitOfWork());
 }
Пример #8
0
 public void SetUp()
 {
     m_uow = Xpo.UnitOfWork();
 }