Ejemplo n.º 1
0
        public void SingleWithInvalidMethod()
        {
            // Arrange
            var translator = new SingleTranslator(_nameChanges);
            Expression <Func <Country> > query = () => _countries.SingleOrDefault(p => !p.IsExists);
            var translation = new TranslationResult();

            // Act
            Assert.Throws <ArgumentOutOfRangeException>(() => translator.Translate((MethodCallExpression)query.Body, translation));

            // Assert
            Assert.NotNull(translation.TableQuery);
            Assert.Null(translation.TableQuery.FilterString);
            Assert.Null(translation.PostProcessing);
        }
Ejemplo n.º 2
0
        public void SingleAfterWhere()
        {
            // Arrange
            var translator = new SingleTranslator(_nameChanges);
            Expression <Func <Country> > query = () => _countries.Where(p => !p.IsExists).Single();
            var translation = new TranslationResult();

            // Act
            translator.Translate((MethodCallExpression)query.Body, translation);

            // Assert
            Assert.NotNull(translation.TableQuery);
            Assert.NotNull(translation.TableQuery.FilterString);
            Assert.Equal("not IsExists", translation.TableQuery.FilterString);
        }