public async Task Returns_receipt_successfully() { //Arrange var forretningsmeldingEnvelope = DomainUtility.GetForretningsmeldingEnvelope(); var documentBundle = AsiceGenerator.Create(DomainUtility.GetForsendelseSimple(), new GuidUtility(), DomainUtility.GetAvsenderCertificate(), DomainUtility.GetKlientkonfigurasjon()); var requestHelper = new RequestHelper(new Klientkonfigurasjon(Miljø.FunksjoneltTestmiljø)); var fakeHttpClientHandlerResponse = new FakeResponseHandler() { HttpContent = new StringContent(XmlResource.Response.GetTransportOk().OuterXml), StatusCode = HttpStatusCode.OK }; requestHelper.HttpClient = new HttpClient(fakeHttpClientHandlerResponse); //Act var kvittering = await requestHelper.SendMessage(forretningsmeldingEnvelope, documentBundle).ConfigureAwait(false); Assert.IsType<TransportOkKvittering>(kvittering); }
public async Task Adds_user_agent() { //Arrange var forretningsmeldingEnvelope = DomainUtility.GetForretningsmeldingEnvelope(); var documentBundle = AsiceGenerator.Create(DomainUtility.GetForsendelseSimple(), new GuidUtility(), DomainUtility.GetAvsenderCertificate(), DomainUtility.GetKlientkonfigurasjon()); Action<HttpRequestMessage> testingAction = message => { Assert.Contains("sikker-digital-post", message.Headers.UserAgent.ToString()); }; var requestHelper = new RequestHelper( new Klientkonfigurasjon(Miljø.FunksjoneltTestmiljø), new FakeResponseHandler() { TestingAction = testingAction, HttpContent = new StringContent(XmlResource.Response.GetTransportOk().OuterXml) } ); //Act await requestHelper.SendMessage(forretningsmeldingEnvelope, documentBundle).ConfigureAwait(false); }