Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
MemoryFailPoint tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ramarag committed Nov 7, 2016
1 parent 97b02b0 commit 755ce2f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/System.Runtime/tests/System.Runtime.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
<Compile Include="System\ActivatorTest.netstandard1.7.cs" />
<Compile Include="System\ExceptionTests.netstandard1.7.cs" />
<Compile Include="System\TypeTests.netstandard1.7.cs" />
<Compile Include="System\Runtime\Tests.netstandard.1.7.cs" />
<Compile Include="System\GCTests.netstandard1.7.cs" />
<Compile Include="$(CommonTestPath)\System\Diagnostics\RemoteExecutorTestBase.cs">
<Link>Common\System\Diagnostics\RemoteExecutorTestBase.cs</Link>
Expand Down
37 changes: 37 additions & 0 deletions src/System.Runtime/tests/System/Runtime/Tests.netstandard.1.7.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// 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.Runtime;
using Xunit;

namespace System.Runtime.Tests
{
public static class RuntimeHelpersTests
{
[Fact]
public static void MemoryFailPointTestNoThrow()
{
MemoryFailPoint memFailPoint = null;

memFailPoint = new MemoryFailPoint(1);
memFailPoint.Dispose();
memFailPoint = new MemoryFailPoint(2);
memFailPoint.Dispose();
}

[Fact]
public static void MemoryFailPointTestThrow()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new MemoryFailPoint(Int32.MinValue));
Assert.Throws<ArgumentOutOfRangeException>(() => new MemoryFailPoint(0));
}

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] //https://github.com/dotnet/coreclr/issues/7807
public static void MemoryFailPointMaxMemoryThrow()
{
Assert.Throws<InsufficientMemoryException>(() => new MemoryFailPoint(Int32.MaxValue));
}
}
}

0 comments on commit 755ce2f

Please sign in to comment.