Beispiel #1
0
 void OnDestroy()
 {
     if (m_inventoryItemLogic != null)
     {
         m_inventoryItemLogic.Release();
         m_inventoryItemLogic = null;
     }
 }
        public void given_deactivated_when_dectivate_then_fails(Guid id, string name)
        {
            var itemBL = new InventoryItemLogic(id, name);

            itemBL.Deactivate();
            itemBL.MarkChangesAsCommitted();

            Assert.Throws <InvalidOperationException>(() => itemBL.Deactivate());
        }
Beispiel #3
0
    void Awake()
    {
        if (m_inventoryItemLogic == null)
        {
            m_inventoryItemLogic = new InventoryItemLogic();
        }

        m_inventoryItemLogic.Initialize(this);
    }
        public void when_created_then_create_message_correct(Guid id, string name)
        {
            var itemBL = new InventoryItemLogic(id, name);

            var events = itemBL.GetUncommittedChanges();

            Assert.Single(events);
            Assert.IsType <InventoryItemCreated>(events.First());
            var createEvent = events.First() as InventoryItemCreated;

            Assert.Equal(id, createEvent.Id);
            Assert.Equal(name, createEvent.Name);
        }
        public void given_created_when_add_then_create_message_correct(Guid id, string name, int count)
        {
            var itemBL = new InventoryItemLogic(id, name);

            itemBL.MarkChangesAsCommitted();

            itemBL.CheckIn(count, 0.1f);

            var events         = itemBL.GetUncommittedChanges();
            var checkedInEvent = events.First() as ItemsCheckedInToInventory;

            Assert.Equal(id, checkedInEvent.Id);
            Assert.Equal(count, checkedInEvent.Count);
        }