public async Task Return_business_item_details() { // arrange var dummyDescription = "dummy description"; var dummyCategory = "dummy category"; var memberId = 1; var dummyMemberName = "dummy member name"; var members = new List <MemberItem> { new MemberItem(memberId, dummyMemberName) }; var startTime = "dummy start time"; var endTime = "dummy end time"; var model = new BusinessItemDetails(_eventId, _startDate, startTime, _endDate, endTime, dummyDescription, dummyCategory, members); _stubGetParliamentEventDetails .GetParliamentEventDetails( Arg.Is <GetParliamentEventDetailsRequest>(request => request.Url == _dummyEventDetailsEndpoint && request.StartDate == _startDate && request.EndDate == _endDate && request.Id == _eventId)) .Returns(GetParliamentEventDetailsResponse.Success(model)); var sut = new GetBusinessItemDetailsController(new GetBusinessItemDetailsService(_stubGetParliamentEventDetailsSettings, _stubGetParliamentEventDetails, _businessItemsDetailsBusinessRules)); // act var result = await sut.GetDetails( _eventId, new GetBusinessItemDetailsQuery { EndDate = _endDate, StartDate = _startDate }); // assert Assert.That(result, Is.TypeOf <OkObjectResult>()); var response = (BusinessItemDetailsModel)((OkObjectResult)result).Value; Assert.That(response.StartTime, Is.EqualTo(startTime)); Assert.That(response.StartDate, Is.EqualTo(_startDate.ToLongDateString())); Assert.That(response.EndTime, Is.EqualTo(endTime)); Assert.That(response.EndDate, Is.EqualTo(_endDate.ToLongDateString())); Assert.That(response.Description, Is.EqualTo(dummyDescription)); Assert.That(response.Category, Is.EqualTo(dummyCategory)); Assert.That(response.Members.ElementAt(0).Id, Is.EqualTo(memberId)); Assert.That(response.Members.ElementAt(0).Name, Is.EqualTo(dummyMemberName)); }
public static GetParliamentEventDetailsResponse Success(BusinessItemDetails businessItemDetails) { return(new GetParliamentEventDetailsResponse(true, businessItemDetails, new List <string>())); }
private GetParliamentEventDetailsResponse(bool isSuccess, BusinessItemDetails businessItemDetails, IEnumerable <string> errorMessages) : base(isSuccess, errorMessages) { BusinessItemDetails = businessItemDetails; }