/// <summary>
        /// 演奏します。
        /// </summary>
        /// <param name="dynamics">強弱</param>
        public void Play(string dynamics)
        {
            switch (dynamics)
            {
            case "pp":
                _currentPlay = new Dynamics.Pianissimo();
                break;

            case "p":
                _currentPlay = new Dynamics.Piano();
                break;

            case "f":
                _currentPlay = new Dynamics.Forte();
                break;

            case "ff":
                _currentPlay = new Dynamics.Fortessimo();
                break;

            default:     //他の強弱記号あるけど、めんどくさいので省略
                break;
            }
            _currentPlay.Play();
        }
        private void IPlayBaseTest(IPlay device, string expectedResult, FakeOutput output)
        {
            //-- Act
            device.Play(new Track());

            //-- Assert
            Assert.AreEqual(output.Result, expectedResult);
        }
示例#3
0
 public void Play()
 {
     if (m_advertisement != null)
     {
         m_advertisement.ShowAdvertisement();
         m_player.Play();
     }
 }
 public void Play()
 {
     if (m_copyRightMark != null)
     {
         m_copyRightMark.ShowCopyRight();
         m_player.Play();
     }
 }
        public void ExternalSpeakerTest()
        {
            output          = new FakeOutput();
            device          = new ExternalSpeaker(new RealSpeaker(2), 20, output);
            expectedMessage = $"{nameof(ExternalSpeaker)} sound";

            //-- Act
            device.Play(new Track());

            //-- Assert
            Assert.AreEqual(output.Result, expectedMessage);
        }
        public void SamsungHeadsetTest()
        {
            output          = new FakeOutput();
            device          = new SamsungHeadset(new RealSpeaker(2), new RealSpeaker(2), 20, output);
            expectedMessage = $"{nameof(SamsungHeadset)} sound";

            //-- Act
            device.Play(new Track());

            //-- Assert
            Assert.AreEqual(output.Result, expectedMessage);
        }
示例#7
0
文件: Form1.cs 项目: imrole/c-
 private void button5_Click(object sender, EventArgs e)
 {
     label1.Text = ip.Play();
 }
示例#8
0
 public string Category()
 {
     return(_play.Play());
 }