Esempio n. 1
0
        public void ErrorWhenWrongVehicleName()
        {
            // Arrange
            Mock <IRepository> mock = GetNumberOfVehicles(4);

            var controller = new AddVehicleOnTrackController(mock.Object);

            // Act
            var result = controller.Add("false").Value;

            // Assert
            Assert.AreEqual(result, "error");
        }
Esempio n. 2
0
        public void ErrorWhen5VehiclesOnTrack()
        {
            // Arrange
            Mock <IRepository> mock = GetNumberOfVehicles(5);

            var controller = new AddVehicleOnTrackController(mock.Object);

            // Act
            var result = controller.Add("car").Value;

            // Assert
            Assert.AreEqual(result, "nok");
        }
Esempio n. 3
0
        public void SuccessWhen4VehiclesOnTrack()
        {
            // Arrange
            Mock <IRepository> mock = GetNumberOfVehicles(4);

            mock.Setup(repo => repo.GetVehicle(VehicleEnum.Car)).Returns(new Vehicle()
            {
                Name = "car"
            });

            var controller = new AddVehicleOnTrackController(mock.Object);

            // Act
            var result = controller.Add("car").Value;

            // Assert
            Assert.AreEqual(result, "ok");
        }