public void TestSkip_NestedMapContainsEmpty_AsIs() { if (!this.ShouldCheckSubtreeUnpacker) { Assert.Ignore("Cannot test subtree unpacker in " + this.GetType().Name); } using (var stream = new MemoryStream(new byte[] { 0x82, 0x1, 0x80, 0x2, 0x81, 0x3, 0x3 })) using (var target = this.CreateUnpacker(stream)) { Assert.That(target.Read()); Assert.That(target.IsMapHeader); Assert.That(target.Read()); Assert.That(target.LastReadData.Equals(0x1)); Assert.That(target.Read()); using (var subTreeReader = target.ReadSubtree()) { Assert.That(subTreeReader.Skip(), Is.EqualTo(0)); } Assert.That(target.Read()); Assert.That(target.LastReadData.Equals(0x2)); Assert.That(target.Read()); using (var subTreeReader = target.ReadSubtree()) { Assert.That(subTreeReader.Skip(), Is.EqualTo(1)); Assert.That(subTreeReader.Skip(), Is.EqualTo(1)); } } }
public async Task TestSkipAsync_BetweenSubtreeReader_NestedArray_AsIs() { if (!this.ShouldCheckSubtreeUnpacker) { #if MSTEST // MSTEST cannot handle inconclusive in async test correctly. await Task.Delay(0); return; #endif // MSTEST Assert.Ignore("Cannot test subtree unpacker in " + this.GetType().Name); } using (var stream = new MemoryStream(new byte[] { 0x93, 0x91, 0x1, 0x2, 0x91, 0x1 })) using (var target = this.CreateUnpacker(stream)) { Assert.That(await target.ReadAsync()); Assert.That(await target.ReadAsync()); using (var subTreeReader = target.ReadSubtree()) { Assert.That(await subTreeReader.SkipAsync(), Is.EqualTo(1)); } Assert.That(await target.SkipAsync(), Is.EqualTo(1)); Assert.That(await target.ReadAsync()); using (var subTreeReader = target.ReadSubtree()) { Assert.That(await subTreeReader.SkipAsync(), Is.EqualTo(1)); } } }
public void TestSkip_BetweenSubtreeReader_NestedMap_AsIs() { if (!this.ShouldCheckSubtreeUnpacker) { Assert.Ignore("Cannot test subtree unpacker in " + this.GetType().Name); } using (var stream = new MemoryStream(new byte[] { 0x83, 0x1, 0x81, 0x2, 0x2, 0x3, 0x3, 0x4, 0x81, 0x4, 0x4 })) using (var target = this.CreateUnpacker(stream)) { Assert.That(target.Read()); Assert.That(target.Skip(), Is.EqualTo(1)); Assert.That(target.Read()); using (var subTreeReader = target.ReadSubtree()) { Assert.That(subTreeReader.Skip(), Is.EqualTo(1)); Assert.That(subTreeReader.Skip(), Is.EqualTo(1)); } Assert.That(target.Skip(), Is.EqualTo(1)); Assert.That(target.Skip(), Is.EqualTo(1)); Assert.That(target.Skip(), Is.EqualTo(1)); Assert.That(target.Read()); using (var subTreeReader = target.ReadSubtree()) { Assert.That(subTreeReader.Skip(), Is.EqualTo(1)); Assert.That(subTreeReader.Skip(), Is.EqualTo(1)); } } }
public void TestSkip_SubtreeReader_NestedArrayContainsEmpty_AsIs() { if (!this.ShouldCheckSubtreeUnpacker) { Assert.Ignore("Cannot test subtree unpacker in " + this.GetType().Name); } using (var stream = new MemoryStream(new byte[] { 0x92, 0x90, 0x91, 0x1 })) using (var target = this.CreateUnpacker(stream)) { Assert.That(target.Read()); Assert.That(target.Read()); using (var subTreeReader = target.ReadSubtree()) { Assert.That(subTreeReader.Skip(), Is.EqualTo(0)); } Assert.That(target.Read()); using (var subTreeReader = target.ReadSubtree()) { Assert.That(subTreeReader.Skip(), Is.EqualTo(1)); } } }
public void BeforeTest(TestDetails testDetails) { BaseBrowsers tb = testDetails.Fixture as BaseBrowsers; if (tb != null && _fixture.Equals(tb.Fixture)) { A.Ignore(string.Format("{0}: {1}", _fixture, _reason)); } }
public void AssertDoesNotThrowInReleaseBuilds() { if (isDebugBuild) { NUnitAssert.Ignore("This test is only for release build mode."); } NUnitAssert.DoesNotThrow(() => { CometPeakAssert.IsTrue(false, "This should NOT be thrown in release builds!"); }); }
public void AssertThrowsInDebugBuilds() { if (!isDebugBuild) { NUnitAssert.Ignore("This test is only for debug build mode."); } NUnitAssert.Throws <AssertionException>(() => { CometPeakAssert.IsTrue(false, "This should be an assertion exception!"); }); }
public void ExportSystemDevice() { // Ignore when not Unix or MacOSX if (Environment.OSVersion.Platform != PlatformID.Unix && Environment.OSVersion.Platform != PlatformID.MacOSX) { Assert.Ignore(); return; } // On export to system device Assert.Throws(typeof(CommandInputException), () => _command.Run(Filename3Unix)); }
public void TestSkip_SubtreeReader_NestedMapContainsEmpty_AsIs() { if (!this.ShouldCheckSubtreeUnpacker) { Assert.Ignore("Cannot test subtree unpacker in " + this.GetType().Name); } using (var stream = new MemoryStream(new byte[] { 0x82, 0x1, 0x80, 0x2, 0x81, 0x3, 0x3 })) using (var target = this.CreateUnpacker(stream)) { Assert.That(target.Skip(), Is.EqualTo(stream.Length)); } }
public async Task TestSkipAsync_SubtreeReader_NestedMapContainsEmpty_AsIs() { if (!this.ShouldCheckSubtreeUnpacker) { #if MSTEST // MSTEST cannot handle inconclusive in async test correctly. await Task.Delay(0); return; #endif // MSTEST Assert.Ignore("Cannot test subtree unpacker in " + this.GetType().Name); } using (var stream = new MemoryStream(new byte[] { 0x82, 0x1, 0x80, 0x2, 0x81, 0x3, 0x3 })) using (var target = this.CreateUnpacker(stream)) { Assert.That(await target.SkipAsync(), Is.EqualTo(stream.Length)); } }
public void TestToString_String_AsNullIFormatProvider() { var originalCurrentCulture = CultureInfo.CurrentCulture; try { #if (!NET35 && !SILVERLIGHT) || WINDOWS_UWP CultureInfo.CurrentCulture = #else // ( !NET35 && !SILVERLIGHT ) || WINDOWS_UWP Thread.CurrentThread.CurrentCulture = #endif // ( !NET35 && !SILVERLIGHT ) || WINDOWS_UWP new LegacyJapaneseCultureInfo(); if (!(CultureInfo.CurrentCulture is LegacyJapaneseCultureInfo) || CultureInfo.CurrentCulture.NumberFormat.NegativeSign != "\uFF0D") { Assert.Ignore("This platform does not support custom culture correctly."); } Assert.That( new Timestamp( -62193657600, 0 ).ToString("s"), Is.EqualTo("\uFF0D0001-03-01T00:00:00Z") ); } finally { #if (!NET35 && !SILVERLIGHT) || WINDOWS_UWP CultureInfo.CurrentCulture = #else // ( !NET35 && !SILVERLIGHT ) || WINDOWS_UWP Thread.CurrentThread.CurrentCulture = #endif // ( !NET35 && !SILVERLIGHT ) || WINDOWS_UWP originalCurrentCulture; } }
public void TestToString_String_IFormatProvider_Distinguishable_s_null_CurrentCultureIsUsed() { var originalCurrentCulture = CultureInfo.CurrentCulture; try { #if (!NET35 && !SILVERLIGHT) || WINDOWS_UWP CultureInfo.CurrentCulture = #else // ( !NET35 && !SILVERLIGHT ) || WINDOWS_UWP Thread.CurrentThread.CurrentCulture = #endif // ( !NET35 && !SILVERLIGHT ) || WINDOWS_UWP new LegacyJapaneseCultureInfo(); if (!(CultureInfo.CurrentCulture is LegacyJapaneseCultureInfo) || CultureInfo.CurrentCulture.NumberFormat.NegativeSign != "\uFF0D") { Assert.Ignore("This platform does not support custom culture correctly."); } Assert.That( new Timestamp( -23215049511, 123456789 ).ToString("s", null), Is.EqualTo("1234-05-06T07:08:09Z") ); } finally { #if (!NET35 && !SILVERLIGHT) || WINDOWS_UWP CultureInfo.CurrentCulture = #else // ( !NET35 && !SILVERLIGHT ) || WINDOWS_UWP Thread.CurrentThread.CurrentCulture = #endif // ( !NET35 && !SILVERLIGHT ) || WINDOWS_UWP originalCurrentCulture; } }
/// <summary> /// Throws an <see cref="IgnoreException"/>. /// This causes the test to be reported as ignored. /// </summary> static public void Ignore() { Assert.Ignore(string.Empty, null); }
/// <summary> /// Throws an <see cref="IgnoreException"/> with the message that is /// passed in. This causes the test to be reported as ignored. /// </summary> /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> static public void Ignore(string message) { Assert.Ignore(message, null); }