예제 #1
0
            public void ReturnsInstance()
            {
                // Arrange
                var inner = Mock.Of <IQueryProvider>();

                // Act
                var provider = new TestDbAsyncQueryProvider <double>(inner);

                // Assert
                Assert.IsType <TestDbAsyncQueryProvider <double> >(provider);
            }
            public void ReturnsQuery()
            {
                // Arrange
                var inner      = Mock.Of <IQueryProvider>();
                var provider   = new TestDbAsyncQueryProvider <double>(inner);
                var expression = Expression.Constant(5.5);

                // Act
                var query = provider.CreateQuery <double>(expression);

                // Assert
                Assert.IsAssignableFrom <IQueryable <double> >(query);
            }
            public void ReturnsResult()
            {
                // Arrange
                var mockInner = new Mock <IQueryProvider>();

                mockInner.Setup(i => i.Execute <double>(It.IsAny <Expression>())).Returns(5.5);
                var inner      = mockInner.Object;
                var provider   = new TestDbAsyncQueryProvider <double>(inner);
                var expression = Expression.Constant(5.5);

                // Act
                var result = provider.Execute <double>(expression);

                // Assert
                Assert.Equal(5.5, result);
            }
            public async Task ReturnsResult()
            {
                // Arrange
                var mockInner = new Mock <IQueryProvider>();

                mockInner.Setup(i => i.Execute <double>(It.IsAny <Expression>())).Returns(5.5);
                var inner             = mockInner.Object;
                var provider          = new TestDbAsyncQueryProvider <double>(inner);
                var expression        = Expression.Constant(5.5);
                var cancellationToken = CancellationToken.None;

                // Act
                var result = await provider.ExecuteAsync <double>(expression, cancellationToken);

                // Assert
                Assert.Equal(5.5, result);
            }
예제 #5
0
 public TestDbAsyncQueryProviderTests()
 {
     provider = new TestDbAsyncQueryProvider <double>(mockInner.Object);
 }