Beispiel #1
0
        public void FacilitySpace_ObjectPlaced_ObserverNotified()
        {
            var space = new FacilitySpace();
            var obs   = new SimpleObserver <FacilitySpace>();
            var obj   = new FacilityObject {
                Type = "Floor", ObjectLayer = ObjectLayer.Ground
            };

            space.Subscribe(obs);

            space.Put(obj);

            Assert.AreEqual(space, obs.LastUpdate);
        }
Beispiel #2
0
        public void FacilitySpace_RemoveValuable_ObserverNotified()
        {
            var space    = new FacilitySpace();
            var obs      = new SimpleObserver <FacilitySpace>();
            var valuable = new ValuableFacilityObject {
                Type = "Vase", ObjectLayer = ObjectLayer.LowerObject
            };

            space.Put(valuable);
            space.Subscribe(obs);

            space.Remove((IValuable)valuable);

            Assert.AreEqual(space, obs.LastUpdate);
        }
Beispiel #3
0
        public void FacilitySpace_NoValuableRemoved_ObserverNotNotified()
        {
            var space = new FacilitySpace();
            var obs   = new SimpleObserver <FacilitySpace>();
            var obj   = new FacilityObject {
                Type = "Floor", ObjectLayer = ObjectLayer.Ground
            };

            space.Put(obj);
            space.Subscribe(obs);

            space.Remove(new FacilityObject {
                Type = "Door"
            });

            Assert.AreEqual(0, obs.UpdateCount);
        }