Example #1
0
        public void SessionStore_Should_NotThrow()
        {
            using (var session = _store.OpenSession())
            {
                var car = new Car
                {
                    Id = Guid.NewGuid(),
                    Make = "Subaru",
                    Model = "Impreza",
                    ImageUrl = "http://www.carsfotodb.com/uploads/subaru/subaru-impreza/subaru-impreza-08.jpg",
                    NumberPlate = "NRM1003" 
                };

                Should.NotThrow(() => session.Store<Car>(car));
            }

        }
Example #2
0
        public void SingleQuotes_ShouldBe_EscapedWhenSaving()
        {
            var car = new Car();
            car.Id = Guid.NewGuid();
            car.Make = "Kia";
            car.Model = "Cee'd";

            var store = new TestStore();
            //save the car
            using (var session = store.OpenSession())
            {
                session.Store(car);
                session.SaveChanges();
            }

            //retrieve and check the make and model are correct
            using (var session = store.OpenSession())
            {
                var savedCar = session.GetById<Car>(car.Id);
                savedCar.Model.ShouldBe("Cee'd");
                savedCar.Make.ShouldBe("Kia");

            }
        }