public void where_one_property_has_a_value_in_a_given_set() { _product1.UnitsInStock = 10; _product2.UnitsInStock = 13; _product3.UnitsInStock = 9; Flush(); var stockLevels = new[] {7, 9, 11, 13}; var products = Session.QueryOver<Product>() .WhereRestrictionOn(p => p.UnitsInStock).IsIn(stockLevels) .List(); Assert.IsFalse(products.Contains(_product1)); Assert.IsTrue(products.Contains(_product2)); Assert.IsTrue(products.Contains(_product3)); products.Each(p => Assert.IsTrue(stockLevels.Contains(p.UnitsInStock.Value))); }
public void where_one_property_has_a_value_in_a_given_set() { _product1.UnitsInStock = 10; _product2.UnitsInStock = 13; _product3.UnitsInStock = 9; Flush(); var stockLevels = new[] {7, 9, 11, 13}; var products = Session.CreateCriteria<Product>() .Add(Restrictions.In("UnitsInStock", stockLevels)) .List<Product>(); Assert.IsFalse(products.Contains(_product1)); Assert.IsTrue(products.Contains(_product2)); Assert.IsTrue(products.Contains(_product3)); products.Each(p => Assert.IsTrue(stockLevels.Contains(p.UnitsInStock.Value))); }