public void FullDockingStation() { var bike = Mock.Of <Bike>(); var bike2 = Mock.Of <Bike>(); DockingStation dockingstation = new DockingStation(1); dockingstation.DockBike(bike); dockingstation.DockBike(bike2); }
public void DockingStation_DockBike_ShouldThrowException_WhennTheBikeIsNotValid() { var dockingStation = new DockingStation(1); Assert.Throws <Exception>(() => dockingStation.DockBike(null, 0)); Action action = () => dockingStation.DockBike(null, 0); action.Should().Throw <Exception>().WithMessage("Null is not a valid bike"); }
public void DockBike_ShouldRaiseException_WhenMax10BikesDocked() { var dockingStation = new DockingStation(10); for (var i = 0; i < 10; i++) { dockingStation.DockBike(new Bike()); } Assert.Throws <Exception>(() => dockingStation.DockBike(new Bike())); }
public void DockingStation_DockBike_ShouldThrowException_WhenThereIsNoSpaceInTheDockingStation() { var bike = new Bike(); var dockingStation = new DockingStation(0); Assert.Throws <Exception>(() => dockingStation.DockBike(bike, 0)); Action action = () => dockingStation.DockBike(bike, 0); action.Should().Throw <Exception>().WithMessage("No space exists"); }
public void DockingStation_DockBike_ShouldThrowException_WhenThereAlreadyABikeParkedInTheLocation() { var bike1 = new Bike(); var bike2 = new Bike(); var dockingStation = new DockingStation(1); dockingStation.DockBike(bike1, 0); Assert.Throws <Exception>(() => dockingStation.DockBike(bike2, 0)); Action action = () => dockingStation.DockBike(bike2, 0); action.Should().Throw <Exception>().WithMessage("Space is taken. MUPPET!"); }
public void ReleaseBike_ShouldReturnWorkingBike_WhenIsWorkingCalled() { var dockingStation = new DockingStation(); var bike = new Bike(); dockingStation.DockBike(bike); Assert.IsTrue(dockingStation.ReleaseBike().IsWorking()); }
public void ReleaseBike_ShouldReturnFakeBike_WhenCalled() { var dockingStation = new DockingStation(); var Fakebike = new Mock <Bike>(); dockingStation.DockBike(Fakebike.Object); Assert.IsInstanceOf(typeof(Bike), dockingStation.ReleaseBike()); }
public void ReleaseBike_ShouldReturnBike_WhenCalled() { var dockingStation = new DockingStation(); var bike = new Bike(); dockingStation.DockBike(bike); Assert.IsInstanceOf(typeof(Bike), dockingStation.ReleaseBike()); }
public void CanDockBike() { var bike = Mock.Of <Bike>(); DockingStation dockingstation = new DockingStation(); dockingstation.DockBike(bike); Assert.AreEqual(1, dockingstation.GetDockedBikes().Count); }
public void EmptyDockingStation2() { var bike = Mock.Of <Bike>(); DockingStation dockingstation = new DockingStation(); dockingstation.DockBike(bike); dockingstation.ReleaseBike(); dockingstation.ReleaseBike(); }
public void DockBike_ShouldPass_WhenMax10BikesFor9Docked() { var dockingStation = new DockingStation(10); for (var i = 0; i < 9; i++) { dockingStation.DockBike(new Bike()); } Assert.AreEqual(9, dockingStation.bikeDock.Count); }
public void ReleaseBike_ShouldRaiseException_WhenBikeIsBroken() { var dockingStation = new DockingStation(10); var bike = new Bike(); bike.IsBroken(); dockingStation.DockBike(bike); Assert.Throws <Exception>(() => dockingStation.ReleaseBike()); }
public void BrokenBike() { Mock <Bike> bike = new Mock <Bike>(); bike.Setup(x => x.GetCondition()).Returns("Broken"); DockingStation dockingstation = new DockingStation(); dockingstation.DockBike(bike.Object); dockingstation.ReleaseBike(); }
public void DockingStation_DockBike_ShouldAddABikeToTheBikeStore() { var bike = new Bike(); var dockingStation = new DockingStation(5); dockingStation.DockBike(bike, 0); Assert.Equal(dockingStation.BikeStore[0], bike); dockingStation.BikeStore[0].Should().Equals(bike); }
public void VanPickUp_PickupBrokenBikes_AddToVanDock() { var brokenBike = new Bike(); brokenBike.IsBroken(); var dockingStation = new DockingStation(); dockingStation.DockBike(brokenBike); var van = new Van(); van.PickupBikeForRepair(dockingStation); Assert.AreEqual(1, van.bikeDock.Count); }
public void VanReleaseBrokenBike_ReleaseBrokenBikes_RemoveFromVanDock() { var brokenBike = new Bike(); brokenBike.IsBroken(); var dockingStation = new DockingStation(); dockingStation.DockBike(brokenBike); var van = new Van(); van.PickupBikeForRepair(dockingStation); Assert.IsInstanceOf(typeof(Bike), van.ReleaseBikeForRepair()); }
public void TakeBikeForRepair_AcceptsBrokenBike_FRomVan() { var brokenBike = new Bike(); brokenBike.IsBroken(); var dockingStation = new DockingStation(); dockingStation.DockBike(brokenBike); var van = new Van(); van.PickupBikeForRepair(dockingStation); var garage = new Garage(); garage.TakeBikeForRepair(van); Assert.IsInstanceOf(typeof(Bike), garage.bikeDock[garage.bikeDock.Count - 1]); }
public void RepairBikes_ShouldChangeBrokenStatusOnBikesToFalse_WhenRepaired() { var brokenBike = new Bike(); brokenBike.IsBroken(); var dockingStation = new DockingStation(); dockingStation.DockBike(brokenBike); var van = new Van(); van.PickupBikeForRepair(dockingStation); var garage = new Garage(); garage.TakeBikeForRepair(van); garage.RepairBikes(); Assert.IsTrue(garage.bikeDock[0].bikeStatus); }
public void DockingStation_ReleaseBike_ShouldRemoveABikeToTheBikeStore() { var bike = new Bike(); var dockingStation = new DockingStation(5); dockingStation.DockBike(bike, 0); Assert.Equal(dockingStation.BikeStore[0], bike); var acquiredBike = dockingStation.ReleaseBike(0); Assert.Null(dockingStation.BikeStore[0]); Assert.Equal(bike, acquiredBike); dockingStation.BikeStore[0].Should().Equals(null); bike.Should().Equals(acquiredBike); }
public void DockingStation_ReportBroken_ShouldChangeTheStateOfBikeWorkingToFalse() { var bike = new Bike(); var dockingStation = new DockingStation(1); dockingStation.DockBike(bike, 0); Assert.True(bike.Working); bike.Working.Should().Equals(true); dockingStation.ReportBroken(0); Assert.False(bike.Working); bike.Working.Should().Equals(false); }
public void VanPicksUpRepairedBike_PicksUpRepairedBikes_RemoveRepairedBikeFromGarage() { var brokenBike = new Bike(); brokenBike.IsBroken(); var dockingStation = new DockingStation(); dockingStation.DockBike(brokenBike); var van = new Van(); van.PickupBikeForRepair(dockingStation); var garage = new Garage(); garage.TakeBikeForRepair(van); garage.RepairBikes(); van.PickupRepairedBike(garage); Assert.IsTrue(van.bikeDock[0].bikeStatus); }