Files
dotnet/UnitTests/UnitTests.HighPerformance.Shared/Extensions/Test_ReadOnlyMemoryExtensions.cs
T
Nirmal Guru 0ab624eaa9 Use Unicode charset without the BOM
Update and follow EditorConfig settings.
BOM: Byte Order Mark (Used to identify UTF-8 encoding).
We don't need BOM specified as the latest editors can work without it.
2021-05-17 12:43:06 -07:00

41 lines
1.2 KiB
C#

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using Microsoft.Toolkit.HighPerformance;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests.HighPerformance.Extensions
{
[TestClass]
public class Test_ReadOnlyMemoryExtensions
{
[TestCategory("ReadOnlyMemoryExtensions")]
[TestMethod]
public void Test_ReadOnlyMemoryExtensions_EmptyMemoryStream()
{
ReadOnlyMemory<byte> memory = default;
Stream stream = memory.AsStream();
Assert.IsNotNull(stream);
Assert.AreEqual(stream.Length, memory.Length);
Assert.IsFalse(stream.CanWrite);
}
[TestCategory("ReadOnlyMemoryExtensions")]
[TestMethod]
public void Test_ReadOnlyMemoryExtensions_MemoryStream()
{
ReadOnlyMemory<byte> memory = new byte[1024];
Stream stream = memory.AsStream();
Assert.IsNotNull(stream);
Assert.AreEqual(stream.Length, memory.Length);
Assert.IsFalse(stream.CanWrite);
}
}
}