Ejemplo n.º 1
0
        public void CanAddWorldObjectToDictionary()
        {
            var dictionary = new WorldObjectDictionary <int, IWorldObject>();
            var mockObject = new Mock <IWorldObject>();

            dictionary.Add(3, mockObject.Object);
            Assert.AreEqual(mockObject.Object, dictionary[3]);
        }
Ejemplo n.º 2
0
        private ObjectTable CreateObjectTable(IActivateableWorldObject[,] tiles)
        {
            var blocks           = new WorldObjectDictionary <Coordinate, IActivateableWorldObject>();
            var shipComponents   = new WorldObjectDictionary <Coordinate, IActivateableWorldObject>();
            var pipeLinks        = new WorldObjectDictionary <CoordinatePair, IActivateableWorldObject>();
            var doubleEdgedPipes = new WorldObjectDictionary <PipePosition, IWorldObject>();

            return(new ObjectTable(tiles, blocks, shipComponents, pipeLinks, doubleEdgedPipes));
        }
Ejemplo n.º 3
0
        public void WorldObjectDeletesWhenRemovedFromDictionary()
        {
            var dictionary = new WorldObjectDictionary <int, IWorldObject>();
            var mockObject = new Mock <IWorldObject>();

            dictionary.Add(3, mockObject.Object);
            dictionary.Remove(3);

            mockObject.Verify(mock => mock.Delete(), Times.Once());
        }
Ejemplo n.º 4
0
 public ObjectTable(
     IActivateableWorldObject[,] tiles,
     WorldObjectDictionary <Coordinate, IActivateableWorldObject> blocks,
     WorldObjectDictionary <Coordinate, IActivateableWorldObject> shipComponents,
     WorldObjectDictionary <CoordinatePair, IActivateableWorldObject> pipeLinks,
     WorldObjectDictionary <PipePosition, IWorldObject> doubleEdgedPipes)
 {
     this.tiles            = tiles;
     this.blocks           = blocks;
     this.shipComponents   = shipComponents;
     this.pipeLinks        = pipeLinks;
     this.doubleEdgedPipes = doubleEdgedPipes;
 }
Ejemplo n.º 5
0
        public void Initialize()
        {
            mockBuilderObject = new Mock <IActivateableWorldObject>();

            tiles            = new IActivateableWorldObject[5, 6];
            blocks           = new WorldObjectDictionary <Coordinate, IActivateableWorldObject>();
            shipComponents   = new WorldObjectDictionary <Coordinate, IActivateableWorldObject>();
            pipeLinks        = new WorldObjectDictionary <CoordinatePair, IActivateableWorldObject>();
            doubleEdgedPipes = new WorldObjectDictionary <PipePosition, IWorldObject>();

            objectTable = new ObjectTable(
                tiles, blocks, shipComponents, pipeLinks, doubleEdgedPipes);
        }
Ejemplo n.º 6
0
        public void Initialize()
        {
            mockBlock = new Mock <IActivateableWorldObject>();
            mockBlock.SetupAllProperties();
            mockShipComponent = new Mock <IActivateableWorldObject>();
            mockShipComponent.SetupAllProperties();
            mockPipeLink = new Mock <IActivateableWorldObject>();
            mockPipeLink.SetupAllProperties();
            mockPipe = new Mock <IWorldObject>();
            mockPipe.SetupAllProperties();

            mockBlockFactory         = new Mock <IFactory <IActivateableWorldObject> >();
            mockShipComponentFactory = new Mock <IFactory <IActivateableWorldObject, IShipComponent> >();
            mockPipeLinkFactory      = new Mock <IFactory <IActivateableWorldObject> >();
            mockPipeFactory          = new Mock <IFactory <IWorldObject, ICurve> >();
            mockBuilder    = new Mock <IBlueprintBuilder>();
            mockBlueprint  = new Mock <IBlueprint>();
            mockController = new Mock <IControlAssigner>();

            mockTile = new Mock <IActivateableWorldObject>();
            tiles    = new IActivateableWorldObject[5, 6];
            foreach (var coordinate in tiles.GetCoordinates())
            {
                tiles.Set(coordinate, new Mock <IActivateableWorldObject>().Object);
            }

            blocks           = new WorldObjectDictionary <Coordinate, IActivateableWorldObject>();
            shipComponents   = new WorldObjectDictionary <Coordinate, IActivateableWorldObject>();
            pipeLinks        = new WorldObjectDictionary <CoordinatePair, IActivateableWorldObject>();
            doubleEdgedPipes = new WorldObjectDictionary <PipePosition, IWorldObject>();
            var objectTable = new ObjectTable(
                tiles, blocks, shipComponents, pipeLinks, doubleEdgedPipes);

            blueprintBuilderViewModel = new ViewModel(
                mockBuilder.Object,
                objectTable,
                mockBlockFactory.Object,
                mockShipComponentFactory.Object,
                mockPipeLinkFactory.Object,
                mockPipeFactory.Object,
                mockController.Object);
        }