コード例 #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);
            }
        }
コード例 #2
0
        private MidiOutPort CreateInitialzedOutPort()
        {
            var port = MidiOutPortTests.CreateMidiOutPort();

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

            return(port);
        }
コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #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);
            }
        }