< Summary

Class:Azure.Core.StringRequestContent
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\core\Azure.Core\src\Shared\AutoRest\StringRequestContent.cs
Covered lines:0
Uncovered lines:10
Coverable lines:10
Total lines:40
Line coverage:0% (0 of 10)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
WriteToAsync()-0%100%
WriteTo(...)-0%100%
TryComputeLength(...)-0%100%
Dispose()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\core\Azure.Core\src\Shared\AutoRest\StringRequestContent.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.IO;
 5using System.Text;
 6using System.Threading;
 7using System.Threading.Tasks;
 8
 9namespace Azure.Core
 10{
 11    internal class StringRequestContent : RequestContent
 12    {
 13        private readonly byte[] _bytes;
 14
 015        public StringRequestContent(string value)
 16        {
 017            _bytes = Encoding.UTF8.GetBytes(value);
 018        }
 19
 20        public override async Task WriteToAsync(Stream stream, CancellationToken cancellation)
 21        {
 022            await stream.WriteAsync(_bytes, 0, _bytes.Length, cancellation).ConfigureAwait(false);
 023        }
 24
 25        public override void WriteTo(Stream stream, CancellationToken cancellation)
 26        {
 027            stream.Write(_bytes, 0, _bytes.Length);
 028        }
 29
 30        public override bool TryComputeLength(out long length)
 31        {
 032            length = _bytes.Length;
 033            return true;
 34        }
 35
 36        public override void Dispose()
 37        {
 038        }
 39    }
 40}