public void RemoveNullBuildingTest() { // given: SmallBuildingSlot SmallBuildingSlot slot = new SmallBuildingSlot(); // when: removing the Building // then: InvalidOperationException Assert.That(() => slot.RemoveBuilding(), Throws.InvalidOperationException); }
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)); }