Exemple #1
0
        public void VehicleTypeTestsAllInOneMethod()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                var fixture                  = new Fixture();
                var autoVehicleType          = fixture.Create <VehicleType>();
                IVehicleTypeRepository vtRep = new VehicleTypeRepository();
                vtRep.Save(autoVehicleType);

                var insertedVehicleType = vtRep.GetById(autoVehicleType.VehicleTypeId);
                Assert.AreEqual(insertedVehicleType.VehicleTypeName, autoVehicleType.VehicleTypeName);

                IEnumerable <VehicleType> vtList = vtRep.GetAll().Where(v => v.VehicleTypeId == autoVehicleType.VehicleTypeId);
                Assert.AreEqual(vtList.Count(), 1);

                vtRep.Delete(autoVehicleType);
                var deletedVehicleType = vtRep.GetById(autoVehicleType.VehicleTypeId);
                Assert.IsNull(deletedVehicleType);
            }
        }