本文整理汇总了C#中ListResult类的典型用法代码示例。如果您正苦于以下问题:C# ListResult类的具体用法?C# ListResult怎么用?C# ListResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListResult类属于命名空间,在下文中一共展示了ListResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RetrievePortManningTest
public async Task RetrievePortManningTest()
{
var portManningResult = new ListResult<PortManning>();
this.portManningData.Setup(mockItem => mockItem.RetrievePortManning(It.IsAny<PortManningSearchParameters>())).Returns(Task.FromResult(portManningResult));
var portMainingDetails = await this.portManningManager.RetrievePortManning(new PortManningSearchParameters());
Assert.AreSame(portManningResult, portMainingDetails);
}
示例2: AssignAlertSearchResult
/// <summary>
/// Assigns the alert search result.
/// </summary>
/// <param name="alertItemList">The alert item list.</param>
public void AssignAlertSearchResult(ListResult<Alert> alertItemList)
{
if (alertItemList != null)
{
this.alertItemListResult = alertItemList;
}
}
示例3: ListAsync
/// <summary>
/// gets the list of gangway history search parameters
/// </summary>
/// <param name="searchParameters"> searchParameters identifier</param>
/// <returns> returns list of gangway history parameters </returns>
public async Task<ListResult<GangwayHistory>> ListAsync(GangwayHistorySearchParameters searchParameters)
{
var list = new ListResult<GangwayHistory>();
var gangwayHistoryList = await this.personEventClientRepository.RetrieveEventListAsync(new PersonHistorySearchParameters { MachineName = searchParameters.MachineName, EventTypeIds = searchParameters.EventTypeIds, ShipId = searchParameters.ShipId, VoyageIds = searchParameters.VoyageIds, PageNumber = searchParameters.PageNumber, PersonTypeId = searchParameters.PersonTypeId, MaxResults = searchParameters.MaxResults, PersonIds = searchParameters.PersonId });
var personTypeList = await DIContainer.Instance.Resolve<IReferenceDataRepository>().RetrievePersonTypeListAsync();
var guestTypePerson = personTypeList.Items.FirstOrDefault(personType => personType.Name.Equals(GuestType, StringComparison.OrdinalIgnoreCase));
var crewTypePerson = personTypeList.Items.FirstOrDefault(personType => personType.Name.Equals(CrewType, StringComparison.OrdinalIgnoreCase));
var visitorTypePerson = personTypeList.Items.FirstOrDefault(personType => personType.Name.Equals(VisitorType, StringComparison.OrdinalIgnoreCase));
var guestIds = guestTypePerson != null ? gangwayHistoryList.Items.DistinctBy(b => b.PersonId).Where(a => a.PersonTypeId.Equals(guestTypePerson.PersonTypeId)).ToList().RetrieveIds(a => a.PersonId) : null;
var crewMemberIds = crewTypePerson != null ? gangwayHistoryList.Items.DistinctBy(b => b.PersonId).Where(a => a.PersonTypeId.Equals(crewTypePerson.PersonTypeId)).ToList().RetrieveIds(a => a.PersonId) : null;
var visitorIds = visitorTypePerson != null ? gangwayHistoryList.Items.DistinctBy(b => b.PersonId).Where(a => a.PersonTypeId.Equals(visitorTypePerson.PersonTypeId)).ToList().RetrieveIds(a => a.PersonId) : null;
var guests = !string.IsNullOrEmpty(guestIds) ? await this.personRepository.RetrieveGuest(null, guestIds, null, null, null, null, null, null, null, null, null, null, null, null, searchParameters.MaxResults, GuestParts) : null;
var crews = !string.IsNullOrEmpty(crewMemberIds) ? GangwayHistoryMapper.MapCrew(await this.personRepository.RetrieveCrew(null, crewMemberIds, null, null, null, null, null, null, null, searchParameters.MaxResults, CrewParts)) : null;
var visitors = !string.IsNullOrEmpty(visitorIds) ? await this.personRepository.RetrieveVisitor(null, visitorIds, null, null, null, null, null, null, searchParameters.MaxResults, VisitorParts) : null;
foreach (var item in gangwayHistoryList.Items)
{
MapPersonInformation(personTypeList, guests, crews, visitors, item);
list.Items.Add(item);
}
list.TotalResults = gangwayHistoryList.TotalResults;
return list;
}
示例4: AutocompleteExporterGetTotal
public void AutocompleteExporterGetTotal()
{
// Arrange
var storeMock = new Mock<IStore<AutocompleteEntity>>();
var listResult = new ListResult<AutocompleteEntity>();
listResult.Status = "ok";
listResult.Total = 2;
listResult.Hits = new List<AutocompleteEntity>
{
new AutocompleteEntity {Id = "testId1"},
new AutocompleteEntity {Id = "testId2"}
};
storeMock.Setup(s => s.List(Helpers.AllSitesId, Helpers.AllLanguages, 0, It.IsAny<int>())).Returns(listResult);
var storeFactoryMock = new Mock<IStoreFactory>();
storeFactoryMock.Setup(f => f.GetStore<AutocompleteEntity>()).Returns(storeMock.Object);
var exporter = new AutocompleteExporter(storeFactoryMock.Object);
// Act
var count = exporter.GetTotalCount(Helpers.AllSitesId, Helpers.AllLanguages);
// Assert
Assert.Equal(2, count);
}
示例5: AutocompleteExporterDeleteAll
public void AutocompleteExporterDeleteAll()
{
// Arrange
var storeMock = new Mock<IStore<AutocompleteEntity>>();
var listResult = new ListResult<AutocompleteEntity>();
listResult.Status = "ok";
listResult.Total = 2;
listResult.Hits = new List<AutocompleteEntity>
{
new AutocompleteEntity {Id = "testId1"},
new AutocompleteEntity {Id = "testId2"}
};
storeMock.Setup(s => s.List(Helpers.AllSitesId, Helpers.AllLanguages, 0, It.IsAny<int>())).Returns(listResult);
var storeFactoryMock = new Mock<IStoreFactory>();
storeFactoryMock.Setup(f => f.GetStore<AutocompleteEntity>()).Returns(storeMock.Object);
var exporter = new AutocompleteExporter(storeFactoryMock.Object);
// Act
exporter.DeleteAll(Helpers.AllSitesId, Helpers.AllLanguages);
// Assert
storeMock.Verify(s => s.Delete(It.IsAny<string>()), Times.Exactly(2));
}
示例6: Map
/// <summary>
/// Maps the alert.
/// </summary>
/// <param name="alerts">The alerts.</param>
/// <param name="personAlert">The person alert.</param>
/// <param name="alertTypeList">The alert Type Master List.</param>
/// <returns>
/// Return instance of alert.
/// </returns>
private static Alert Map(IEnumerable<DataAccess.Entities.Alert> alerts, DataAccess.Entities.PersonAlert personAlert, ListResult<DataAccess.Entities.AlertType> alertTypeList)
{
var alert = alerts.FirstOrDefault(a => a.AlertId.Equals(personAlert.AlertId, StringComparison.OrdinalIgnoreCase));
var alertType = alert != null ? alertTypeList.Items.FirstOrDefault(a => a.AlertTypeId.Equals(alert.AlertTypeId, StringComparison.OrdinalIgnoreCase)) : null;
if (alertType != null)
{
return new Alert
{
AlertId = personAlert.PersonAlertId,
AddedDateTime = alert.AddedDate,
AddedBy = alert.AddedBy,
Message = new Message
{
Subject = alert.Code,
Description = alert.Description,
},
StatusUpdatedBy = personAlert.StatusUpdatedBy,
StatusUpdatedDate = personAlert.StatusUpdatedDate,
AlertType = alertType.Name,
IsDenyAshore = alertType.AlertTypeId.Equals(IsDenyAshoreId, StringComparison.OrdinalIgnoreCase) || alertType.AlertTypeId.Equals(IsDenyBothId, StringComparison.OrdinalIgnoreCase) || alertType.AlertTypeId.Equals(IsCBPClearanceId, StringComparison.OrdinalIgnoreCase),
IsDenyOnboard = alertType.AlertTypeId.Equals(IsDenyOnboardId, StringComparison.OrdinalIgnoreCase) || alertType.AlertTypeId.Equals(IsDenyBothId, StringComparison.OrdinalIgnoreCase),
IsOverride = alert.IsOverride,
IsSoundEnable = alert.IsSoundEnable
};
}
return null;
}
示例7: ImportPortManningTest
public async Task ImportPortManningTest()
{
var portManningResult = new ListResult<PortManning>();
this.portManningData.Setup(mockItem => mockItem.ImportPortManning(It.IsNotNull<ImportPortManning>())).Returns(Task.FromResult(portManningResult));
var portMainingDetails = await this.portManningManager.ImportPortManning(new ImportPortManning());
Assert.AreSame(portManningResult, portMainingDetails);
}
示例8: ShipControllerTest
/// <summary>
/// Initializes a new instance of the <see cref="ShipControllerTest"/> class.
/// </summary>
public ShipControllerTest()
{
this.shipManager = new Mock<IShipManager>();
this.shipCollection = new ListResult<Ship>();
this.controller = new ShipController(this.shipManager.Object);
this.controller.Request = new HttpRequestMessage();
this.controller.Configuration = new HttpConfiguration();
}
示例9: MapGuests
/// <summary>
/// Maps the guests.
/// </summary>
/// <param name="guest">The guest.</param>
/// <param name="personMessages">The messages.</param>
/// <param name="messageTypeList">The message Type Master List.</param>
internal static void MapGuests(Guest guest, ListResult<DataAccess.Entities.PersonMessage> personMessages, ListResult<DataAccess.Entities.MessageType> messageTypeList)
{
var messageCollection = MessageMapper.MapCollection(personMessages.Items, guest.GuestId, messageTypeList);
if (messageCollection != null && messageCollection.Count > 0)
{
guest.HasMessage = true;
guest.AssignMessages(messageCollection);
}
}
示例10: MapVisitors
/// <summary>
/// Maps the visitors.
/// </summary>
/// <param name="visitor">The visitor.</param>
/// <param name="alerts">The alerts.</param>
/// <param name="personAlerts">The person alerts.</param>
/// <param name="alertTypeList">The alert Type Master List.</param>
internal static void MapVisitors(Visitor visitor, ListResult<DataAccess.Entities.Alert> alerts, ListResult<DataAccess.Entities.PersonAlert> personAlerts, ListResult<DataAccess.Entities.AlertType> alertTypeList)
{
var alertCollection = AlertMapper.MapCollection(alerts.Items, personAlerts.Items, visitor.VisitorId, alertTypeList);
if (alertCollection != null && alertCollection.Count > 0)
{
visitor.HasAlert = true;
visitor.AssignAlerts(alertCollection);
}
}
示例11: MapCrews
/// <summary>
/// Maps the crews.
/// </summary>
/// <param name="crewmember">The crew member.</param>
/// <param name="alerts">The alerts.</param>
/// <param name="personAlerts">The person alerts.</param>
/// <param name="alertTypeList">The alert Type Master List.</param>
internal static void MapCrews(Crewmember crewmember, ListResult<DataAccess.Entities.Alert> alerts, ListResult<DataAccess.Entities.PersonAlert> personAlerts, ListResult<DataAccess.Entities.AlertType> alertTypeList)
{
var alertCollection = AlertMapper.MapCollection(alerts.Items, personAlerts.Items, crewmember.CrewmemberId, alertTypeList);
if (alertCollection != null && alertCollection.Count > 0)
{
crewmember.HasAlert = true;
crewmember.AssignAlerts(alertCollection);
}
}
示例12: MapGuests
/// <summary>
/// Maps the guests.
/// </summary>
/// <param name="guest">The guest.</param>
/// <param name="alerts">The alerts.</param>
/// <param name="personAlerts">The person alerts.</param>
/// <param name="alertTypeList">The alert Type Master List.</param>
internal static void MapGuests(Guest guest, ListResult<DataAccess.Entities.Alert> alerts, ListResult<DataAccess.Entities.PersonAlert> personAlerts, ListResult<DataAccess.Entities.AlertType> alertTypeList)
{
var alertCollection = AlertMapper.MapCollection(alerts.Items, personAlerts.Items, guest.GuestId, alertTypeList);
if (alertCollection != null && alertCollection.Count > 0)
{
guest.HasAlert = true;
guest.AssignAlerts(alertCollection);
}
}
示例13: MapCrews
/// <summary>
/// Maps the crews.
/// </summary>
/// <param name="crewmember">The crew member.</param>
/// <param name="personMessages">The messages.</param>
/// <param name="messageTypeList">The message Type Master List.</param>
internal static void MapCrews(Crewmember crewmember, ListResult<DataAccess.Entities.PersonMessage> personMessages, ListResult<DataAccess.Entities.MessageType> messageTypeList)
{
var messageCollection = MessageMapper.MapCollection(personMessages.Items, crewmember.CrewmemberId, messageTypeList);
if (messageCollection != null && messageCollection.Count > 0)
{
crewmember.HasMessage = true;
crewmember.AssignMessages(messageCollection);
}
}
示例14: MapVisitors
/// <summary>
/// Maps the visitors.
/// </summary>
/// <param name="visitor">The visitor.</param>
/// <param name="personMessages">The messages.</param>
/// <param name="messageTypeList">The message Type Master List.</param>
internal static void MapVisitors(Visitor visitor, ListResult<DataAccess.Entities.PersonMessage> personMessages, ListResult<DataAccess.Entities.MessageType> messageTypeList)
{
var messageCollection = MessageMapper.MapCollection(personMessages.Items, visitor.VisitorId, messageTypeList);
if (messageCollection != null && messageCollection.Count > 0)
{
visitor.HasMessage = true;
visitor.AssignMessages(messageCollection);
}
}
示例15: MapListAsync
/// <summary>
/// Maps the list asynchronous.
/// </summary>
/// <param name="brandList">The brand list.</param>
/// <returns>List of Brand.</returns>
internal static ListResult<Brand> MapListAsync(ListResult<Entities.Brand> brandList)
{
var brandCollection = new ListResult<Brand>();
foreach (var ship in brandList.Items)
{
brandCollection.Items.Add(MapAsync(ship));
}
return brandCollection;
}