Esempio n. 1
0
 public OnPurchaseLand(NWPlayer player, string sector, string areaName, string areaTag, string areaResref, PCBaseType pcBaseType)
 {
     Player     = player;
     Sector     = sector;
     AreaName   = areaName;
     AreaTag    = areaTag;
     AreaResref = areaResref;
     PCBaseType = pcBaseType;
 }
Esempio n. 2
0
        public void GetByID_OneItem_ReturnsPCBaseType()
        {
            // Arrange
            PCBaseType entity = new PCBaseType {
                ID = 1
            };

            // Act
            MessageHub.Instance.Publish(new OnCacheObjectSet <PCBaseType>(entity));

            // Assert
            Assert.AreNotSame(entity, _cache.GetByID(1));
        }
Esempio n. 3
0
        public void GetByID_TwoItems_ReturnsCorrectObject()
        {
            // Arrange
            PCBaseType entity1 = new PCBaseType {
                ID = 1
            };
            PCBaseType entity2 = new PCBaseType {
                ID = 2
            };

            // Act
            MessageHub.Instance.Publish(new OnCacheObjectSet <PCBaseType>(entity1));
            MessageHub.Instance.Publish(new OnCacheObjectSet <PCBaseType>(entity2));

            // Assert
            Assert.AreNotSame(entity1, _cache.GetByID(1));
            Assert.AreNotSame(entity2, _cache.GetByID(2));
        }
Esempio n. 4
0
        public void GetByID_RemovedItem_ReturnsCorrectObject()
        {
            // Arrange
            PCBaseType entity1 = new PCBaseType {
                ID = 1
            };
            PCBaseType entity2 = new PCBaseType {
                ID = 2
            };

            // Act
            MessageHub.Instance.Publish(new OnCacheObjectSet <PCBaseType>(entity1));
            MessageHub.Instance.Publish(new OnCacheObjectSet <PCBaseType>(entity2));
            MessageHub.Instance.Publish(new OnCacheObjectDeleted <PCBaseType>(entity1));

            // Assert
            Assert.Throws <KeyNotFoundException>(() => { _cache.GetByID(1); });
            Assert.AreNotSame(entity2, _cache.GetByID(2));
        }
Esempio n. 5
0
        public void GetByID_NoItems_ThrowsKeyNotFoundException()
        {
            // Arrange
            PCBaseType entity1 = new PCBaseType {
                ID = 1
            };
            PCBaseType entity2 = new PCBaseType {
                ID = 2
            };

            // Act
            MessageHub.Instance.Publish(new OnCacheObjectSet <PCBaseType>(entity1));
            MessageHub.Instance.Publish(new OnCacheObjectSet <PCBaseType>(entity2));
            MessageHub.Instance.Publish(new OnCacheObjectDeleted <PCBaseType>(entity1));
            MessageHub.Instance.Publish(new OnCacheObjectDeleted <PCBaseType>(entity2));

            // Assert
            Assert.Throws <KeyNotFoundException>(() => { _cache.GetByID(1); });
            Assert.Throws <KeyNotFoundException>(() => { _cache.GetByID(2); });
        }