public void Dispose_CallsRelease_WhenCalled() { // Arrange var bayOne = Substitute.For <IBay>(); bayOne.IsEmpty.Returns(true); var bayTwo = Substitute.For <IBay>(); bayTwo.IsEmpty.Returns(true); var factory = Substitute.For <IBayFactory>(); factory.Create(Arg.Any <int>()).Returns(bayOne, bayTwo); var vehicleOne = Substitute.For <IVehicle>(); var vehicleTwo = Substitute.For <IVehicle>(); BaysManager sut = CreateSut(3, factory); sut.AssignBay(vehicleOne); sut.AssignBay(vehicleTwo); // Act sut.Dispose(); // Assert factory.Received().Release(bayOne); factory.Received().Release(bayTwo); }
public void Dispose_ReleasesBays_WhenCalled() { // Arrange var factory = Substitute.For <IBayFactory>(); BaysManager sut = CreateSut(3, factory); // Act sut.Dispose(); // Assert factory.Received(3).Release(Arg.Any <IBay>()); }