public void EnumerableMoqqerQuery_Select_SingleLevel_IntoMultiPropertyAnnonymousType() { var list = new List <Level0> { new Level0() }; var queryable = new EnumerableMoqqerQuery <Level0>(list); var q = queryable.Select(x => new { FirstProperty = x.L1.L2.L3.L4.L5.Name, SecondProperty = x.L1.L2, ConstantProperty = 25, StringProeprty = "Test", MethodCallProperty = Math.Abs(-69) }); var res = q.First(); res.FirstProperty.Should().Be(null); res.SecondProperty.Should().Be(null); res.ConstantProperty.Should().Be(25); res.StringProeprty.Should().Be("Test"); res.MethodCallProperty.Should().Be(69); }
private EnumerableMoqqerQuery <Level0> GetQueryable(string key, Action <Level0> action = null) { var list = GetItems(key, action); var queryable = new EnumerableMoqqerQuery <Level0>(list); return(queryable); }
public void EnumerableMoqqerQuery_Select_SingleNestedProperty() { var list = new List <Level0> { new Level0() }; var queryable = new EnumerableMoqqerQuery <Level0>(list); var q = queryable.Select(x => x.L1.L2.L3.L4.L5.Name); var res = q.FirstOrDefault(); res.Should().Be(null); }
public void EnumerableMoqqerQuery_Select_SingleLevel_IntoSinglePropertyAnnonymousType() { var list = new List <Level0> { new Level0() }; var queryable = new EnumerableMoqqerQuery <Level0>(list); var q = queryable.Select(x => new { SingleProperty = x.L1.L2.L3.L4.L5.Name }); var res = q.First(); res.SingleProperty.Should().Be(null); }
public void EnumerableMoqqerQuery_Where_ExpressionType_GreaterThan_SingleLevel() { var list = new List <Level0> { new Level0() }; var queryable = new EnumerableMoqqerQuery <Level0>(list); var q = queryable.Where(x => x.L1.L2.L3.L4.L5.Decimal > 25); var res = q.FirstOrDefault(); res.Should().BeNull("single level does not have non null references until decimal"); }
public void EnumerableMoqqerQuery_Where_ExpressionType_GreaterThan_AllLevels() { var list = new List <Level0> { AllLevels }; var queryable = new EnumerableMoqqerQuery <Level0>(list); var q = queryable.Where(x => x.L1.L2.L3.L4.L5.Decimal > 25); var res = q.FirstOrDefault(); res.Should().NotBeNull("All Levels has decimal of 100"); }
public void EnumerableMoqqerQuery_Where_ExpressionType_Equal_SingleLevel() { var list = new List <Level0> { new Level0() }; var queryable = new EnumerableMoqqerQuery <Level0>(list); // ReSharper disable once ReplaceWithSingleCallToFirstOrDefault var q = queryable.Where(x => x.L1.L2.L3.L4.L5.Name == "Name"); var res = q.FirstOrDefault(); res.Should().BeNull("as deepest level doesn't even exist"); }
public void EnumerableMoqqerQuery_Where_ExpressionType_Equal_AllLevels_ComaprisonReturnsTrue() { var list = new List <Level0> { AllLevels }; var queryable = new EnumerableMoqqerQuery <Level0>(list); // ReSharper disable once ReplaceWithSingleCallToFirstOrDefault var q = queryable.Where(x => x.L1.L2.L3.L4.L5.Name == "Name"); var res = q.FirstOrDefault(); res.Should().NotBeNull(); }
public void EnumerableMoqqerQuery_Where_ExpressionType_LessThanOrEqual_SingleLevel() { var list = new List <Level0> { new Level0() }; var queryable = new EnumerableMoqqerQuery <Level0>(list); // ReSharper disable once ReplaceWithSingleCallToFirstOrDefault var q = queryable.Where(x => x.L1.L2.L3.L4.L5.Decimal <= 25); var res = q.FirstOrDefault(); res.Should().BeNull("single level."); }