public void FirstAfterWhere() { // Arrange var translator = new FirstTranslator(_nameChanges); Expression<Func<Country>> query = () => _countries.Where(p => !p.IsExists).First(); var translation = new TranslationResult(); // Act && Assert translator.Translate((MethodCallExpression) query.Body, translation); Assert.NotNull(translation.TableQuery); Assert.NotNull(translation.TableQuery.FilterString); Assert.Equal("not IsExists", translation.TableQuery.FilterString); }
public void FirstWithInvalidMethod() { // Arrange var translator = new FirstTranslator(_nameChanges); Expression<Func<Country>> query = () => _countries.FirstOrDefault(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); }