public void Init() { baseUri = new Uri("http://base.org/"); context = new DataServiceContext(baseUri); personQueryable = this.CreateSingletonQuery <Person>("Vip"); customerQueryable = this.CreateSingletonQuery <Customer>("Vip"); }
public void Initialize_WithProvider() { QueryableBase <int> queryable = new TestQueryable <int> (_providerMock); Assert.That(queryable.Provider, Is.SameAs(_providerMock)); Assert.That(queryable.Expression, Is.Not.Null); Assert.That(queryable.Expression.NodeType, Is.EqualTo(ExpressionType.Constant)); }
public void Initialize_WithProvider () { QueryableBase<int> queryable = new TestQueryable<int> (_providerMock); Assert.That (queryable.Provider, Is.SameAs (_providerMock)); Assert.That (queryable.Expression, Is.Not.Null); Assert.That (queryable.Expression.NodeType, Is.EqualTo (ExpressionType.Constant)); }
public void Initialize_WithProviderAndExpression() { QueryableBase <int> queryable = new TestQueryable <int> (_providerMock, _intArrayExpression); Assert.That(queryable.Provider, Is.SameAs(_providerMock)); Assert.That(queryable.Expression, Is.SameAs(_intArrayExpression)); Assert.That(queryable.ElementType, Is.EqualTo(typeof(int))); }
public void Initialize_WithProviderAndExpression () { QueryableBase<int> queryable = new TestQueryable<int> (_providerMock, _intArrayExpression); Assert.That (queryable.Provider, Is.SameAs (_providerMock)); Assert.That (queryable.Expression, Is.SameAs (_intArrayExpression)); Assert.That (queryable.ElementType, Is.EqualTo (typeof (int))); }
public void GenericGetEnumerator() { _providerMock.Expect(mock => mock.Execute <IEnumerable <int> > (_intArrayExpression)).Return(new List <int>(0)); _providerMock.Replay(); QueryableBase <int> queryable = new TestQueryable <int> (_providerMock, _intArrayExpression); queryable.GetEnumerator(); _providerMock.VerifyAllExpectations(); }
public void SetUp() { _mockRepository = new MockRepository(); _queryParserMock = _mockRepository.StrictMock <IQueryParser> (); _executorMock = _mockRepository.StrictMock <IQueryExecutor> (); _queryProvider = new TestQueryProvider(_queryParserMock, _executorMock); _queryableWithDefaultParser = new TestQueryable <Cook> (QueryParser.CreateDefault(), _executorMock); _fakeQueryModel = ExpressionHelper.CreateQueryModel <Cook> (); }
public void SetUp() { _mockRepository = new MockRepository(); _queryParserMock = _mockRepository.StrictMock<IQueryParser> (); _executorMock = _mockRepository.StrictMock<IQueryExecutor> (); _queryProvider = new TestQueryProvider (_queryParserMock, _executorMock); _queryableWithDefaultParser = new TestQueryable<Cook> (QueryParser.CreateDefault(), _executorMock); _fakeQueryModel = ExpressionHelper.CreateQueryModel<Cook> (); }
public void Initialize_WithParserAndExecutor () { var fakeExecutor = _mockRepository.Stub<IQueryExecutor>(); var fakeParser = _mockRepository.Stub<IQueryParser> (); QueryableBase<int> queryable = new TestQueryable<int> (fakeParser, fakeExecutor); Assert.That (queryable.Expression, Is.Not.Null); Assert.That (queryable.Expression.NodeType, Is.EqualTo (ExpressionType.Constant)); Assert.That (queryable.Provider, Is.InstanceOf (typeof (DefaultQueryProvider))); var queryProvider = ((DefaultQueryProvider) queryable.Provider); Assert.That (queryProvider.Executor, Is.SameAs (fakeExecutor)); Assert.That (queryProvider.QueryableType, Is.SameAs (typeof (TestQueryable<>))); Assert.That (queryProvider.QueryParser, Is.SameAs (fakeParser)); }
public void Initialize_WithParserAndExecutor() { var fakeExecutor = _mockRepository.Stub <IQueryExecutor>(); var fakeParser = _mockRepository.Stub <IQueryParser> (); QueryableBase <int> queryable = new TestQueryable <int> (fakeParser, fakeExecutor); Assert.That(queryable.Expression, Is.Not.Null); Assert.That(queryable.Expression.NodeType, Is.EqualTo(ExpressionType.Constant)); Assert.That(queryable.Provider, Is.InstanceOf(typeof(DefaultQueryProvider))); var queryProvider = ((DefaultQueryProvider)queryable.Provider); Assert.That(queryProvider.Executor, Is.SameAs(fakeExecutor)); Assert.That(queryProvider.QueryableType, Is.SameAs(typeof(TestQueryable <>))); Assert.That(queryProvider.QueryParser, Is.SameAs(fakeParser)); }
private Expression CreateExpression <TElement>(string methodName, TestQueryable <TElement> queryable) { return(Expression.Call(typeof(Queryable), methodName, new[] { queryable.ElementType }, queryable.Expression)); }
public void GenericGetEnumerator () { _providerMock.Expect (mock => mock.Execute<IEnumerable<int>> (_intArrayExpression)).Return (new List<int>(0)); _providerMock.Replay (); QueryableBase<int> queryable = new TestQueryable<int> (_providerMock, _intArrayExpression); queryable.GetEnumerator(); _providerMock.VerifyAllExpectations(); }