public void GetById_Should_NotByNull() { using (var session = _store.OpenSession()) { var first = session.GetById <EntityForGetByIdTests>(_dummyCars[0].Id); first.ShouldNotBe(null); } }
public void IQueryable_Should_ImplementOrderBy() { using (var session = _store.OpenSession()) { var cars = session.Query <EntityForLinqOrderByTests>().Where(c => c.PropertyOne == "Mazda").OrderBy(o => o.PropertyTwo).ToList(); cars[0].PropertyTwo.ShouldBe("A"); cars[1].PropertyTwo.ShouldBe("B"); } }
public void GetAllCreatesTheTableIfItDoesNotExist() { using (var session = _store.OpenSession()) { var things = session.GetAll <SomeTestClassThatNoOneWillEverUse>().ToList(); things.Count.ShouldBe(0); } }
public void GetAllCreatesTheTableIfItDoesNotExist() { var store = new TestStore(); using (var session = store.OpenSession()) { var things = session.GetAll<SomeTestClassThatNoOneWillEverUse>().ToList(); things.Count.ShouldBe(0); } }
public void SingleQuotes_ShouldBe_EscapedWhenSaving() { _entity = new EntityForCorrectEscapingTests() { Id = Guid.NewGuid(), PropertyOne = "Kia", PropertyTwo = "Cee'd" }; //save the car using (var session = _store.OpenSession()) { session.Store(_entity); session.SaveChanges(); } //retrieve and check the make and model are correct using (var session = _store.OpenSession()) { var savedCar = session.GetById <EntityForCorrectEscapingTests>(_entity.Id); savedCar.PropertyTwo.ShouldBe("Cee'd"); savedCar.PropertyOne.ShouldBe("Kia"); } }
public GetByIdTests(DocumentStoreBaseFixture data) { _store = data.TestStore; _dummyCars = new Fixture().CreateMany <EntityForGetByIdTests>().ToList(); using (var session = _store.OpenSession()) { foreach (var car in _dummyCars) { session.Store(car); } session.SaveChanges(); } }
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"); } }
public LinqOrderByTests(DocumentStoreBaseFixture data) { _store = data.TestStore; var carA = new Fixture().Build <EntityForLinqOrderByTests>() .With(x => x.PropertyOne, "Mazda") .With(y => y.PropertyTwo, "A") .Create(); var carB = new Fixture().Build <EntityForLinqOrderByTests>() .With(x => x.PropertyOne, "Mazda") .With(y => y.PropertyTwo, "B") .Create(); using (var session = _store.OpenSession()) { session.Store(carA); session.Store(carB); session.SaveChanges(); } }
public LinqOrderByTests() { _testStore = new StoreInfo(); _store = new TestStore(); var carA = new Fixture().Build<Car>() .With(x => x.Make, "Mazda") .With(y => y.Model, "A") .Create(); var carB = new Fixture().Build<Car>() .With(x => x.Make, "Mazda") .With(y => y.Model, "B") .Create(); using (var session = _store.OpenSession()) { session.Store<Car>(carA); session.Store<Car>(carB); session.SaveChanges(); } }
public void Store_Should_OpenSession() { using (var session = _store.OpenSession()) { //not really doing anything } }