Files
linux-packaging-mono/external/corefx/src/System.Threading.Timer/tests/TimerChangeTests.netstandard.cs
Xamarin Public Jenkins (auto-signing) 6bdd276d05 Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
2017-04-10 11:41:01 +00:00

29 lines
1.1 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.Threading;
using Xunit;
public partial class TimerChangeTests
{
[Fact]
public void Timer_Change_Int64_Negative()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-2, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-1, (long)-2));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)0xffffffff, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-1, (long)0xffffffff));
}
[Fact]
public void Timer_Change_UInt32_Int64_AfterDispose_Throws()
{
var t = new Timer(EmptyTimerTarget);
t.Dispose();
Assert.Throws<ObjectDisposedException>(() => t.Change(0u, 0u));
Assert.Throws<ObjectDisposedException>(() => t.Change(0L, 0L));
}
}