public void CombinedTest() { const string parameterName = "TestParameter"; var parameter = new Parameter <int>(parameterName); Assert.AreEqual(parameterName, parameter.Name); Assert.Throws <NotSupportedException>(() => _ = parameter.Value); var firstContext = new ParameterContext(); firstContext.SetValue(parameter, 10); Assert.AreEqual(10, firstContext.GetValue(parameter)); firstContext.SetValue(parameter, 15); Assert.AreEqual(15, firstContext.GetValue(parameter)); var secondContext = new ParameterContext(firstContext); Assert.AreEqual(15, secondContext.GetValue(parameter)); secondContext.SetValue(parameter, 20); Assert.AreEqual(20, secondContext.GetValue(parameter)); Assert.AreEqual(15, firstContext.GetValue(parameter)); firstContext.SetValue(parameter, 25); Assert.AreEqual(25, firstContext.GetValue(parameter)); Assert.AreEqual(20, secondContext.GetValue(parameter)); }
public void ConfusingParameterTest() { var parameter = new Parameter <Tuple>("ConfusingParameter"); var parameterContext = new ParameterContext(); parameterContext.SetValue(parameter, Tuple.Create(false)); TestQuery( () => from o in Session.Demand().Query.All <MyEntity>() where o.HasStupidName == parameterContext.GetValue(parameter).GetValueOrDefault <bool>(0) select o ); }