Esempio n. 1
0
 public void ConstructorTest2()
 {
     var device = new DeviceInfo(s98type, clock, pan);
     Assert.AreEqual(type, device.DeviceType);
     Assert.AreEqual(clock, device.Clock);
     Assert.AreEqual(pan, device.Pan);
     Assert.AreEqual(s98type, device.S98DeviceType);
 }
Esempio n. 2
0
 public void ConstructorTest1()
 {
     var device = new DeviceInfo();
     Assert.AreEqual(Sharp98.DeviceType.None, device.DeviceType);
     Assert.AreEqual(0, device.Clock);
     Assert.AreEqual(PanFlag.Stereo, device.Pan);
     Assert.AreEqual(Sharp98.S98.DeviceType.None, device.S98DeviceType);
 }
Esempio n. 3
0
        public void Export1Test()
        {
            var device = new DeviceInfo(s98type, clock, pan);

            var output1 = device.Export(Encoding.UTF8);
            var output2 = device.Export(null);

            CollectionAssert.AreEqual(output1, output2);
            Assert.IsNotNull(output1);
            Assert.AreEqual(16, output1.Length);
        }
Esempio n. 4
0
        private static DeviceInfo[] ImportDevice(uint deviceCount, Stream stream, byte[] buffer)
        {
            if (deviceCount == 0)
                return new DeviceInfo[] { DeviceInfo.DefaultDevice };
            else
            {
                var di = new DeviceInfo[deviceCount];
                stream.Read(buffer, 0, 16);

                for (int i = 0; i < deviceCount; i++)
                    di[i] = DeviceInfo.Import(buffer);

                return di;
            }
        }
Esempio n. 5
0
 public void Export2Error2()
 {
     var device = new DeviceInfo(s98type, clock, pan);
     var buffer = new byte[16];
     var size = device.Export(buffer, -1, 16, null);
 }
Esempio n. 6
0
 public void Export2Error1()
 {
     var device = new DeviceInfo(s98type, clock, pan);
     var size = device.Export(null, 0, 16, null);
 }
Esempio n. 7
0
 public void ConstructorError4()
 {
     var device = new DeviceInfo(s98type, clock, unchecked((PanFlag)(-1)));
 }
Esempio n. 8
0
 public void ConstructorError2()
 {
     var device = new DeviceInfo(s98type, 0, pan);
 }
Esempio n. 9
0
 public void ConstructorError3()
 {
     var device = new DeviceInfo(s98type, int.MaxValue + 1u, pan);
 }
Esempio n. 10
0
        public void Import1Test()
        {
            var device = new DeviceInfo(s98type, clock, pan);
            byte[] buffer = device.Export(null);
            var new_device = DeviceInfo.Import(buffer);

            Assert.AreEqual(type, new_device.DeviceType);
            Assert.AreEqual(clock, new_device.Clock);
            Assert.AreEqual(pan, new_device.Pan);
            Assert.AreEqual(s98type, new_device.S98DeviceType);
        }
Esempio n. 11
0
 public void ConstructorError1()
 {
     var device = new DeviceInfo(unchecked((Sharp98.S98.DeviceType)(-1)), clock, pan);
 }
Esempio n. 12
0
 public void Import1Error3()
 {
     var device = new DeviceInfo(s98type, clock, pan);
     byte[] buffer = device.Export(null);
     var new_device = DeviceInfo.Import(buffer, 16);
 }
Esempio n. 13
0
        public void Export3Test()
        {
            var device = new DeviceInfo(s98type, clock, pan);
            byte[] buffer;

            using (var ms = new MemoryStream())
            {
                device.Export(ms, null);
                ms.Flush();
                buffer = ms.ToArray();
            }

            Assert.AreEqual(16, buffer.Length);
        }
Esempio n. 14
0
        public void Export3Error2()
        {
            var device = new DeviceInfo(s98type, clock, pan);
            byte[] buffer = new byte[16];

            using (var ms = new MemoryStream(buffer, false))
            {
                device.Export(ms, null);
            }
        }
Esempio n. 15
0
 public void Export3Error1()
 {
     var device = new DeviceInfo(s98type, clock, pan);
     device.Export(null, null);
 }
Esempio n. 16
0
        public void Export2Test()
        {
            var device = new DeviceInfo(s98type, clock, pan);
            var buffer = new byte[16];
            var size = device.Export(buffer, 0, 16, null);

            Assert.AreEqual(16, size);
        }