public void DisposeCorrectlyTest() { // Named memory mapped files aren't supported on Unix based systems. // So we need to skip this test. Skip.IfNot(Environment.OSVersion.Platform == PlatformID.Win32NT, "Mumble Link is only supported in Windows"); var client = new Gw2MumbleClient(); client.Dispose(); Assert.ThrowsAny <ObjectDisposedException>(() => client.Update()); }
public void DisposeCorrectlyTest() { using var reader = Substitute.For <IGw2MumbleClientReader>(); var client = new Gw2MumbleClient(_ => reader); client.Dispose(); Action act = () => client.Update(); act.Should().Throw <ObjectDisposedException>(); }
public void DisposeAllFromRootCorrectlyTest() { // Named memory mapped files aren't supported on Unix based systems. // So we need to skip this test. Skip.IfNot(Environment.OSVersion.Platform == PlatformID.Win32NT, "Mumble Link is only supported in Windows"); var rootClient = new Gw2MumbleClient(); var childClientA = rootClient["CinderSteeltemper"]; var childClientB = rootClient["VishenSteelshot"]; rootClient.Dispose(); Assert.ThrowsAny <ObjectDisposedException>(() => rootClient.Update()); Assert.ThrowsAny <ObjectDisposedException>(() => childClientA.Update()); Assert.ThrowsAny <ObjectDisposedException>(() => childClientB.Update()); }
public void DisposeAllFromRootCorrectlyTest() { using var reader = Substitute.For <IGw2MumbleClientReader>(); var rootClient = new Gw2MumbleClient(_ => reader); var childClientA = rootClient["CinderSteeltemper"]; var childClientB = rootClient["VishenSteelshot"]; rootClient.Dispose(); using (new AssertionScope()) { Action actRoot = () => rootClient.Update(); Action actChildA = () => childClientA.Update(); Action actChildB = () => childClientB.Update(); // Everything should be disposed actRoot.Should().Throw <ObjectDisposedException>(); actChildA.Should().Throw <ObjectDisposedException>(); actChildB.Should().Throw <ObjectDisposedException>(); } }