Beispiel #1
0
        public void CheckIfShipComponentFactoryIsUsedToAddShipComponents()
        {
            var position = new Coordinate(5, 4);

            //mockBlockFactories.Setup(x => x.Create()).Returns(mockBlock.Object);
            mockShipComponentFactory.Setup(x => x.Create(mockBlock.Object)).Returns(mockShipComponent.Object);
            mockShipComponent.Setup(m => m.CanBePlaced(blueprint, position)).Returns(true);

            Assert.IsTrue(blueprintBuilder.CreateBlock(position));
            Assert.IsTrue(blueprintBuilder.CreateShipComponent(position));
            mockBlock.Verify(block => block.AddShipComponent(mockShipComponent.Object), Times.Once());
        }
Beispiel #2
0
        public void CheckThatShipComponentFactoryIsAssignedWhenUsingSimpleConstructor()
        {
            var dimensions       = new Coordinate(4, 5);
            var blueprintBuilder = new BlueprintBuilder(dimensions);
            var position         = new Coordinate(1, 2);

            Assert.IsTrue(blueprintBuilder.CreateBlock(position));
            Assert.IsTrue(blueprintBuilder.CreateShipComponent(position));
        }