protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _context.Dispose();
         _context = null;
     }
 }
        public VehicleControllerTests()
        {
            _context = new MockContext();
            _context.Users.Add(new User
            {
                Id = 1,
                Username = "******"
            });

            var make = new Make
            {
                Id = 1,
                Name = "make"
            };

            var model = new Model
            {
                Id = 1,
                Name = "model",
                Make = make
            };

            var user = new User
            {
                Id = 1,
                Email = "Test"
            };

            make.Models = new List<Model> {model};

            _context.Models.Add(model);
            _context.Makes.Add(make);

            _context.Vehicles.Add(new Vehicle
            {
                Id = 1,
                Year = "2015",
                Kilometers = 100,
                Model = model,
                User = user
            });
            _context.Vehicles.Add(new Vehicle
            {
                Id = 2,
                Year = "2014",
                Kilometers = 1000,
                Model = model,
                User = user
            });

            user.Vehicles = new List<Vehicle>();
            user.Vehicles.Add(_context.Vehicles.First());
            user.Vehicles.Add(_context.Vehicles.Last());
        }
Example #3
0
 public VehicleStore(IMaintenanceTrackerContext context)
 {
     _context = context;
 }
Example #4
0
 public UserStore(IMaintenanceTrackerContext context, IEncryptor encryptor)
 {
     _context = context;
     _encrpytor = encryptor;
 }