public void PlaceBuildingOccupiedTest()
        {
            // given: SmallBuildingSlot and Buildings
            Mock <IBuilding> buildingMock  = new Mock <IBuilding>(MockBehavior.Strict);
            Mock <IBuilding> buildingMock2 = new Mock <IBuilding>(MockBehavior.Strict);

            SmallBuildingSlot slot = new SmallBuildingSlot();

            slot.PlaceBuilding(buildingMock.Object);

            // when: placing the second slot
            // then: InvalidOperationException thrown
            Assert.That(() => slot.PlaceBuilding(buildingMock2.Object), Throws.InvalidOperationException);
        }
        public void PlaceNullBuildingTest()
        {
            // given: SmallBuildingSlot
            SmallBuildingSlot slot = new SmallBuildingSlot();

            // when: placing a null Building
            // then: ArgumentNullException
            Assert.That(() => slot.PlaceBuilding(null), Throws.ArgumentNullException);
        }
        public void PlaceBuildingTest()
        {
            // given: SmallBuildingSlot and Building
            Mock <IBuilding> buildingMock = new Mock <IBuilding>(MockBehavior.Strict);

            SmallBuildingSlot slot = new SmallBuildingSlot();

            // when: placing the slot
            slot.PlaceBuilding(buildingMock.Object);

            // then: Building is places
            Assert.That(slot.Building, Is.SameAs(buildingMock.Object));
        }
        public void RemoveBuildingTest()
        {
            // given: SmallBuildingSlot with a Building
            Mock <IBuilding> buildingMock = new Mock <IBuilding>(MockBehavior.Strict);

            SmallBuildingSlot slot = new SmallBuildingSlot();

            slot.PlaceBuilding(buildingMock.Object);

            // when: removing the Building
            var removedBuilding = slot.RemoveBuilding();

            // then: slot Building is null and correct Building was returned
            Assert.That(slot.Building, Is.Null);
            Assert.That(removedBuilding, Is.SameAs(buildingMock.Object));
        }
        public void SimulateTest()
        {
            // given: SmallBuildingSlot with building mock
            Mock <IBuilding> buildingMock = new Mock <IBuilding>(MockBehavior.Strict);

            buildingMock.Setup(b => b.Simulate());

            SmallBuildingSlot slot = new SmallBuildingSlot();

            slot.PlaceBuilding(buildingMock.Object);

            // when: simulating the slot
            slot.Simulate();

            // then: building was simulated
            Assert.That(() => buildingMock.Verify(b => b.Simulate(), Times.Once), Throws.Nothing);
        }