# Summary

Class: | WireMock.Owin.OwinResponseMapper
Assembly: | WireMock.Net
File(s): | C:\Users\Stef\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\OwinResponseMapper.cs
Covered lines: | 12
Uncovered lines: | 0
Coverable lines: | 12
Total lines: | 47
Line coverage: | 100%
Branch coverage: | 75%

# Metrics

Method | Cyclomatic complexity | NPath complexity | Sequence coverage | Branch coverage
--- | --- | --- | --- | ---
.ctor() | 1 | 0 | 100 | 100
MapAsync() | 8 | 4 | 100 | 80

# File(s)

## C:\Users\Stef\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\OwinResponseMapper.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System.IO;`
|  | `2` |  | `using System.Linq;`
|  | `3` |  | `using System.Text;`
|  | `4` |  | `using System.Threading.Tasks;`
|  | `5` |  | `#if NET45`
|  | `6` |  | `using Microsoft.Owin;`
|  | `7` |  | `#else`
|  | `8` |  | `using Microsoft.AspNetCore.Http;`
|  | `9` |  | `#endif`
|  | `10` |  | ``
|  | `11` |  | `namespace WireMock.Owin`
|  | `12` |  | `{`
|  | `13` |  | `/// <summary>`
|  | `14` |  | `/// OwinResponseMapper`
|  | `15` |  | `/// </summary>`
|  | `16` |  | `public class OwinResponseMapper`
|  | `17` |  | `{`
| 16 | `18` |  | `private readonly Encoding _utf8NoBom = new UTF8Encoding(false);`
|  | `19` |  | ``
|  | `20` |  | `/// <summary>`
|  | `21` |  | `/// MapAsync ResponseMessage to OwinResponse`
|  | `22` |  | `/// </summary>`
|  | `23` |  | `/// <param name="responseMessage"></param>`
|  | `24` |  | `/// <param name="response"></param>`
|  | `25` |  | `public async Task MapAsync(ResponseMessage responseMessage`
|  | `26` |  | `#if NET45`
|  | `27` |  | `, IOwinResponse response`
|  | `28` |  | `#else`
|  | `29` |  | `, HttpResponse response`
|  | `30` |  | `#endif`
|  | `31` |  | `)`
| 13 | `32` |  | `{`
| 13 | `33` |  | `response.StatusCode = responseMessage.StatusCode;`
|  | `34` |  | ``
| 14 | `35` |  | `responseMessage.Headers.ToList().ForEach(pair => response.Headers.Append(pair.Key, pair.Value));`
|  | `36` |  | ``
| 13 | `37` |  | `if (responseMessage.Body == null)`
| 2 | `38` |  | `return;`
|  | `39` |  | ``
| 11 | `40` |  | `Encoding encoding = responseMessage.BodyEncoding ?? _utf8NoBom;`
| 11 | `41` |  | `using (var writer = new StreamWriter(response.Body, encoding))`
| 11 | `42` |  | `{`
| 11 | `43` |  | `await writer.WriteAsync(responseMessage.Body);`
| 11 | `44` |  | `}`
| 13 | `45` |  | `}`
|  | `46` |  | `}`
|  | `47` |  | `}`

# Methods/Properties

.ctor()
MapAsync()