private void AddNewVehicle()
        {
            Vehicle vehiculo;

            if (cbxTipo.SelectedValue.Equals(VehicleType.Moto.ToString()))
            {
                vehiculo = new Moto(txbBrand.Text, txbModel.Text, (int)nudYear.Value, dtpAdded.Value, (double)nudKilometers.Value);
            }
            else
            {
                vehiculo = new Car(txbBrand.Text, txbModel.Text, (int)nudYear.Value, dtpAdded.Value, (double)nudKilometers.Value);
            }
            service.Add(vehiculo);
        }
Esempio n. 2
0
        public void Test1()
        {
            var repo = new Mock <IRepository <string, Car> >();

            repo.Setup(r => r.Exists(It.IsAny <string>())).Returns(false);
            var unitUnderTest = new VehiclesService(repo.Object);

            for (int i = 0; i < 10000; i++)
            {
                unitUnderTest.Add(VehiclesTestData.CreateCarRequest());
            }


            Assert.Pass();
        }
Esempio n. 3
0
        public void Add_SomeName_Passes()
        {
            // arrange/given
            var request = VehiclesTestData.CreateCarRequest();

            // act/when
            var result = _unitUnderTest.Add(request);

            // assert/than
            Assert.IsTrue(result);
        }