Skip to content

Instantly share code, notes, and snippets.

@ritalin
Created October 1, 2012 08:49
Show Gist options
  • Save ritalin/3810393 to your computer and use it in GitHub Desktop.
Save ritalin/3810393 to your computer and use it in GitHub Desktop.
TestCase passing byte Arrays
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace ClassLibrary2
{
[TestFixture]
public class Class1
{
[TestCase((byte)1, (byte)2, (byte)3, (byte)4)]
public void TestCase1(params byte[] arr) {
Assert.That(arr[0], Is.EqualTo(1));
}
[TestCase(new byte[] { 0x00, 0x01, 0x02, 0x03 })]
public void sample(byte[] input) {
Assert.That(input, Is.EqualTo(new byte[] { 0x00, 0x01, 0x02, 0x03 }));
}
[TestCase(new byte[] { 0x00, 0x00, 0x00, 0x01 }, 100, 200)]
public void sample2(byte[] input, int n1, int n2) {
Assert.That(input, Is.EqualTo(new byte[] { 0x00, 0x00, 0x00, 0x01 }));
Assert.That(n1, Is.EqualTo(100));
Assert.That(n2, Is.EqualTo(200));
}
[TestCase(new byte[] { 0x00, 0x00, 0x00, 0x01 }, new byte[] { 0x02, 0x04, 0x06, 0x08 })]
public void sample3(byte[] input1, byte[] input2) {
Assert.That(input1, Is.EqualTo(new byte[] { 0x00, 0x00, 0x00, 0x01 }));
Assert.That(input2, Is.EqualTo(new byte[] { 0x02, 0x04, 0x06, 0x08 }));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment