Exemplo n.º 1
0
        public void RemoveScooter_CorrectId_ShouldRemove()
        {
            service.AddScooter("1", 0.2M);

            service.GetScooters().Count.Should().Be(1);
            service.RemoveScooter("1");
            service.GetScooters().Should().BeEmpty();
        }
Exemplo n.º 2
0
        public void RemoveScooter()
        {
            var newScooterId = "1";

            ScooterService.AddScooter(newScooterId, 1);
            Assert.IsNotNull(ScooterService.GetScooterById(newScooterId));

            ScooterService.RemoveScooter(newScooterId);

            Assert.IsNull(ScooterService.GetScooterById(newScooterId));
        }
Exemplo n.º 3
0
        public void RemoveScooter_RentedScooter_ThrowsExceptionScooterIsRented()
        {
            // Arrange
            string scooterId = "Scooter";

            // Act
            _scooterService.ScooterList.Add(new Scooter(scooterId, 0.5m));
            _scooterService.GetScooterById(scooterId).IsRented = true;
            // Assert
            Assert.ThrowsException <ScooterIsRented>(() => _scooterService.RemoveScooter(scooterId));
        }
Exemplo n.º 4
0
        public void RemoveScooter_ScooterNotRented_CallsRemove()
        {
            var scooter = new Scooter("id", 1);

            _scooterRepositoryMock.Setup(x => x.GetById("id")).Returns(scooter);

            _scooterService.RemoveScooter("id");

            _scooterRepositoryMock.Verify(x => x.Remove("id"));
        }
Exemplo n.º 5
0
 public void RemoveScooterWrongArgument(string expectedArgument, string scooterId)
 {
     Assert.Throws <ArgumentException>(expectedArgument, () => _scooterService.RemoveScooter(scooterId));
 }