public void FacilityMap_WhenShowingLayer_AllObjectsInWorld()
        {
            var floor = CreateFloor();

            _sampleSpace.Put(floor);
            _sampleLayer.Put(1, 1, _sampleSpace);
            _map.Add(_sampleLayer);

            _map.ShowLayer(0);

            Assert.AreEqual(floor, _world.ObjectAt(new XYZ(1, 1, 0), ObjectLayer.Ground));
        }
Example #2
0
        public void FacilitySpace_ReplaceObjectInLayer_LaterObjectExistsInSpace()
        {
            var space  = new FacilitySpace();
            var street = new FacilityObject {
                Type = "Street", ObjectLayer = ObjectLayer.Ground
            };
            var floor = new FacilityObject {
                Type = "Floor", ObjectLayer = ObjectLayer.Ground
            };

            space.Put(street);
            space.Put(floor);

            Assert.AreEqual(floor, space.Ground);
        }
Example #3
0
        public void FacilitySpace_PutUnknownLayerObject_ThrowsException()
        {
            var space  = new FacilitySpace();
            var street = new FacilityObject {
                Type = "Garbage", ObjectLayer = ObjectLayer.Unknown
            };

            space.Put(street);
        }
Example #4
0
        public void FacilitySpace_PutObject_ObjectPlacedCorrectly()
        {
            var space  = new FacilitySpace();
            var street = new FacilityObject {
                Type = "Street", ObjectLayer = ObjectLayer.Ground
            };

            space.Put(street);

            Assert.AreEqual(street, space.Ground);
        }
Example #5
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);
        }
Example #6
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);
        }
Example #7
0
        public void FacilitySpace_ValuableInContainer_ReturnsCorrectly()
        {
            var space     = new FacilitySpace();
            var container = new ValuablesContainer {
                ObjectLayer = ObjectLayer.LowerObject
            };

            container.Put(new Valuable {
                Type = "Diamond"
            });
            space.Put(container);

            var valuables = space.Valuables.ToList();

            Assert.AreEqual(1, valuables.Count());
            Assert.IsTrue(valuables.Any(x => x.Type.Equals("Diamond")));
        }
Example #8
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);
        }