Skip to content

TestCaseSource unable to pass one element byte array #1851

@m-wilczynski

Description

@m-wilczynski

NUnit version: 3.5.0
Runner: NUnit3TestAdapter 3.4.1
Environment: Visual Studio 2015 Pro Update 1

I'm having troubles using one element byte array passed to NUnit test with TestCaseSourceAttribute.

How to reproduce:

public class Test
    {
        private static List<byte[]> _byteArrays = new List<byte[]>
        {
            new byte[] { 80 }, // - works fine with commented out
            new byte[] { 80, 75 },
            new byte[] { 80, 75, 03 }
        };

        [Test]
        [TestCaseSource("_byteArrays")]
        public void TestStuff(byte[] byteArray)
        {
            Assert.IsFalse(false);
        }
    }

When you run TestStuff it will attempt to test things in seperate tests like this:

nunit

It clearly seems that first element is treated as an System.Byte instead of System.Byte[].

Error produced by NUnit tells it clearly:

Result Message:System.ArgumentException : Object of type 'System.Byte' cannot be converted to type 'System.Byte[]'

Any ideas on fixing this?
Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions