private AddSentOnAatfSite AddSentOnAatfSiteRequest() { var siteRequest = new AddSentOnAatfSite() { AatfId = Guid.NewGuid(), ReturnId = Guid.NewGuid(), OrganisationId = Guid.NewGuid(), SiteAddressData = new AatfAddressData() { CountryId = Guid.NewGuid(), Address1 = "address1", Address2 = "address2", CountyOrRegion = "county", Name = "name", Postcode = "postcode", TownOrCity = "town" }, OperatorAddressData = new OperatorAddressData() { CountryId = Guid.NewGuid(), Address1 = "address1OP", Address2 = "address2OP", CountyOrRegion = "countyOP", Name = "nameOP", Postcode = "postcodeOP", TownOrCity = "townOP" } }; return(siteRequest); }
public async void IndexPost_GivenValidViewModel_ApiSendShouldBeCalled() { var model = new SentOnCreateSiteViewModel { SiteAddressData = new AatfAddressData("TEST", "TEST", "TEST", "TEST", "TEST", "TEST", Guid.NewGuid(), "TEST") }; var request = new AddSentOnAatfSite(); A.CallTo(() => requestCreator.ViewModelToRequest(model)).Returns(request); await controller.Index(model, null); A.CallTo(() => apiClient.SendAsync(A <string> ._, request)).MustHaveHappened(Repeated.Exactly.Once); }
public SentOnAatfSite ViewModelToRequest(SentOnCreateSiteViewModel viewModel) { if (viewModel.Edit) { return(new EditSentOnAatfSite() { SiteAddressData = viewModel.SiteAddressData, WeeeSentOnId = (Guid)viewModel.WeeeSentOnId, OperatorAddressData = viewModel.OperatorAddressData, }); } var aatfSite = new AddSentOnAatfSite() { OrganisationId = viewModel.OrganisationId, ReturnId = viewModel.ReturnId, AatfId = viewModel.AatfId, SiteAddressData = viewModel.SiteAddressData, OperatorAddressData = viewModel.OperatorAddressData }; return(aatfSite); }