本文整理汇总了C#中IQueryable.Concat方法的典型用法代码示例。如果您正苦于以下问题:C# IQueryable.Concat方法的具体用法?C# IQueryable.Concat怎么用?C# IQueryable.Concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQueryable
的用法示例。
在下文中一共展示了IQueryable.Concat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmployerControllerTest
public EmployerControllerTest()
{
_data = new List<Employee>
{
new Employee {EmployeeID = 1, Name = "Aimen", Address = "Address" , Age = 1, Employment = 1, Active = 1},
new Employee {EmployeeID = 2, Name = "Max", Address = "Address" , Age = 1, Employment = 1, Active = 1},
new Employee {EmployeeID = 3, Name = "Alex", Address = "Address" , Age = 1, Employment = 1, Active = 1},
}.AsQueryable();
_mockSet = new Mock<DbSet<Employee>>();
_mockSet.As<IQueryable<Employee>>().Setup(m => m.Provider).Returns(_data.Provider);
_mockSet.As<IQueryable<Employee>>().Setup(m => m.Expression).Returns(_data.Expression);
_mockSet.As<IQueryable<Employee>>().Setup(m => m.ElementType).Returns(_data.ElementType);
_mockSet.As<IQueryable<Employee>>().Setup(m => m.GetEnumerator()).Returns(_data.GetEnumerator());
_mockER = new Mock<IEmployeeRepository>();
_mockER.Setup(t => t.Get()).Returns(_mockSet.Object);
_mockER.Setup(t => t.Get(x => x.EmployeeID == It.IsAny<int>())).Returns(_mockSet.Object);
_mockER.Setup(t => t.Add(It.IsAny<Employee>())).Callback((Employee employee) =>
{
var newListEmployee = new List<Employee> { employee };
_data = _data.Concat(newListEmployee);
}).Verifiable();
_mockER.Setup(t => t.Delete(It.IsAny<Employee>())).Callback((Employee employee) =>
{
//var newListEmployee = new List<Employee> { employee };
var list = new List<Employee>();
list = _data.ToList();
list.Remove(employee);
_data = list.AsQueryable();
}).Verifiable();
//_mockER.Verify(mr => mr.Update(It.IsAny<Employee>()), Times.Once());
//_mockER.Setup(t => t.Delete(It.IsAny<int>()));
//_mockER.Setup(t => t.Delete(It.IsAny<Employee>()));
_mockER.Setup(t => t.Update(It.IsAny<Employee>()));
_mockUW = new Mock<IUnitOfWork>();
_mockUW.Setup(t => t.SaveChanges());
_mockHttpContext = new Mock<HttpContextBase>();
_mockRequest = new Mock<HttpRequestBase>();
_FormKeys = new NameValueCollection();
_mockHttpContext.Setup(ctxt => ctxt.Request).Returns(_mockRequest.Object);
_mockRequest.Setup(r => r.Form).Returns(_FormKeys);
}
示例2: GetRelatedPeopleUnionQuery
/// <summary>
/// Add a Query to an existing Query to create a Union Query.
/// </summary>
/// <param name="query"></param>
/// <param name="unionQuery"></param>
private IQueryable<RelatedPersonInfo> GetRelatedPeopleUnionQuery( IQueryable<RelatedPersonInfo> query, IQueryable<RelatedPersonInfo> unionQuery )
{
return ( query == null ? unionQuery : query.Concat( unionQuery ) );
}
示例3: Concat
private IQueryable<PublisherDO> Concat(IQueryable<PublisherDO> first, IQueryable<PublisherDO> second)
{
if (first == null)
{
return second;
}
else
{
return first.Concat(second);
}
}