예제 #1
0
        public void List_Two_Vehicles()
        {
            var context = new MockContext();
            context.Vehicles.Add(new Vehicle
            {
                Id = 1,
                Kilometers = 1337,
                Model = _model,
                User = _user
            });
            context.Vehicles.Add(new Vehicle
            {
                Id = 2,
                Kilometers = 1338,
                Model = _model,
                User = _user
            });
            var store = new VehicleStore(context);

            var result = store.ListVehicles(_user.Username);

            Assert.AreEqual(2, result.Count());
            var vehicle = result.First();
            Assert.AreEqual(1337, vehicle.Kilometers);
            Assert.AreEqual(1, vehicle.Id);
            Assert.AreEqual(_user, vehicle.User);
            Assert.AreEqual(_model, vehicle.Model);
            vehicle = result.Last();
            Assert.AreEqual(1338, vehicle.Kilometers);
            Assert.AreEqual(2, vehicle.Id);
            Assert.AreEqual(_user, vehicle.User);
            Assert.AreEqual(_model, vehicle.Model);
        }
예제 #2
0
        public void List_Empty_Vehicles()
        {
            var context = new MockContext();
            var store = new VehicleStore(context);

            var result = store.ListVehicles(_user.Username);

            Assert.AreEqual(0, result.Count());
        }