public async Task single_or_default_returns_first() { var user0 = new SimpleUser { UserName = "******", Number = 4, Birthdate = new DateTime(1986, 10, 4), Address = new SimpleAddress { HouseNumber = "0", Street = "rue de l'invisible" } }; var user1 = new SimpleUser { UserName = "******", Number = 5, Birthdate = new DateTime(1986, 10, 4), Address = new SimpleAddress { HouseNumber = "12bis", Street = "rue de la martre" } }; theSession.Store(user0, user1); await theSession.SaveChangesAsync(); var userJson = await theSession.Query <SimpleUser>().Where(x => x.Number == 5).ToJsonSingleOrDefault(); userJson.ShouldBeSemanticallySameJsonAs($@"{user1.ToJson()}"); }
public async Task single_async_returns_first_and_only() { var user1 = new SimpleUser { UserName = "******", Number = 5, Birthdate = new DateTime(1986, 10, 4), Address = new SimpleAddress { HouseNumber = "12bis", Street = "rue de la martre" } }; theSession.Store(user1); await theSession.SaveChangesAsync(); var userJson = await theSession.Query <SimpleUser>().ToJsonSingle(); userJson.ShouldBeSemanticallySameJsonAs($@"{user1.ToJson()}"); }
public async Task first_async_returns_first_line() { var user0 = new SimpleUser { UserName = "******", Number = 4, Birthdate = new DateTime(1986, 10, 4), Address = new SimpleAddress { HouseNumber = "0", Street = "rue de l'invisible" } }; var user1 = new SimpleUser { UserName = "******", Number = 5, Birthdate = new DateTime(1986, 10, 4), Address = new SimpleAddress { HouseNumber = "12bis", Street = "rue de la martre" } }; var user2 = new SimpleUser { UserName = "******", Number = 5, Birthdate = new DateTime(1987, 10, 4), Address = new SimpleAddress { HouseNumber = "12bis", Street = "rue de la martre" } }; theSession.Store(user0, user1, user2); await theSession.SaveChangesAsync(); var userJson = await theSession.Query <SimpleUser>().ToJsonFirst(); userJson.ShouldBeSemanticallySameJsonAs($@"{user0.ToJson()}"); }
public async Task to_list_async() { var user0 = new SimpleUser { UserName = "******", Number = 4, Birthdate = new DateTime(1986, 10, 4), Address = new SimpleAddress { HouseNumber = "0", Street = "rue de l'invisible" } }; var user1 = new SimpleUser { UserName = "******", Number = 5, Birthdate = new DateTime(1986, 10, 4), Address = new SimpleAddress { HouseNumber = "12bis", Street = "rue de la martre" } }; var user2 = new SimpleUser { UserName = "******", Number = 6, Birthdate = new DateTime(1987, 10, 4), Address = new SimpleAddress { HouseNumber = "12bis", Street = "rue de la martre" } }; theSession.Store(user0, user1, user2); await theSession.SaveChangesAsync(); var listJson = await theSession.Query <SimpleUser>().Where(x => x.Number >= 5).ToJsonArray(); listJson.ShouldBeSemanticallySameJsonAs($@"[{user1.ToJson()},{user2.ToJson()}]"); }