Exemplo n.º 1
0
        public void Initialize_PortNotOpen_AllBuffersUnused()
        {
            using (var port = MidiOutPortTests.CreateMidiOutPort())
            {
                port.BufferManager.Initialize(2, 256);

                Assert.AreEqual(port.BufferManager.BufferCount, port.BufferManager.UnusedBufferCount);
            }
        }
Exemplo n.º 2
0
        private MidiOutPort CreateInitialzedOutPort()
        {
            var port = MidiOutPortTests.CreateMidiOutPort();

            port.BufferManager.Initialize(2, 256);
            port.Open(0);

            return(port);
        }
Exemplo n.º 3
0
        public void Initialize_BuffersCreated_BufferSizeMatches()
        {
            using (var port = MidiOutPortTests.CreateMidiOutPort())
            {
                port.BufferManager.Initialize(2, 256);
                port.Open(0);

                Assert.AreEqual(256, port.BufferManager.BufferSize);
            }
        }
Exemplo n.º 4
0
        public void Retrieve_InitializedBufferManager_ReturnsNonNull()
        {
            using (var port = MidiOutPortTests.CreateMidiOutPort())
            {
                port.BufferManager.Initialize(2, 256);
                port.Open(0);

                var buffer = port.BufferManager.RetrieveBuffer();

                Assert.IsNotNull(buffer);

                // return buffer or we get an exception on Dispose
                port.BufferManager.ReturnBuffer(buffer);
            }
        }
Exemplo n.º 5
0
        public void Retrieve_InitializedBufferManager_OneMoreUnusuableBuffer()
        {
            using (var port = MidiOutPortTests.CreateMidiOutPort())
            {
                port.BufferManager.Initialize(2, 256);
                port.Open(0);

                var buffer = port.BufferManager.RetrieveBuffer();

                Assert.AreEqual(1, port.BufferManager.UnusedBufferCount);

                // return buffer or we get an exception on Dispose
                port.BufferManager.ReturnBuffer(buffer);
            }
        }