Skip to content

Commit

Permalink
refactor: #13 changed using namespace of unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroxpepe committed Mar 10, 2021
1 parent 6826dbe commit 95de7cc
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 64 deletions.
23 changes: 12 additions & 11 deletions MidiPlayerTests/PlayListTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

using Microsoft.VisualStudio.TestTools.UnitTesting;
using static Microsoft.VisualStudio.TestTools.UnitTesting.Assert;

namespace MidiPlayer.Test {
[TestClass()]
Expand All @@ -10,18 +11,18 @@ public void NextTest1() {
_target.Add("file1.mid");
_target.Add("file2.mid");
_target.Add("file3.mid");
Assert.AreEqual("file1.mid", _target.Next);
Assert.AreEqual("file2.mid", _target.Next);
Assert.AreEqual("file3.mid", _target.Next);
Assert.AreEqual("file1.mid", _target.Next);
Assert.AreEqual("file2.mid", _target.Next);
AreEqual("file1.mid", _target.Next);
AreEqual("file2.mid", _target.Next);
AreEqual("file3.mid", _target.Next);
AreEqual("file1.mid", _target.Next);
AreEqual("file2.mid", _target.Next);
_target.Add("file4.mid");
Assert.AreEqual("file3.mid", _target.Next);
Assert.AreEqual("file4.mid", _target.Next);
Assert.AreEqual("file1.mid", _target.Next);
Assert.AreEqual("file2.mid", _target.Next);
Assert.AreEqual("file3.mid", _target.Next);
Assert.AreEqual("file4.mid", _target.Next);
AreEqual("file3.mid", _target.Next);
AreEqual("file4.mid", _target.Next);
AreEqual("file1.mid", _target.Next);
AreEqual("file2.mid", _target.Next);
AreEqual("file3.mid", _target.Next);
AreEqual("file4.mid", _target.Next);
}
}
}
7 changes: 4 additions & 3 deletions MidiPlayerTests/SoundFontTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

using Microsoft.VisualStudio.TestTools.UnitTesting;
using static Microsoft.VisualStudio.TestTools.UnitTesting.Assert;

namespace MidiPlayer.SoundFont.Tests {
[TestClass()]
Expand All @@ -8,11 +9,11 @@ public class SoundFontInfoTests {
public void GetVoiceTest() {
var _target = new SoundFontInfo("../data/OmegaGMGS2.sf2");
var _result1 = _target.GetVoice(0, 0);
Assert.AreEqual("Grand Piano", _result1); // bank:0, prog:0
AreEqual("Grand Piano", _result1); // bank:0, prog:0
var _result2 = _target.GetVoice(8, 38);
Assert.AreEqual("Synth Bass 3", _result2); // bank:8, prog:38
AreEqual("Synth Bass 3", _result2); // bank:8, prog:38
var _result3 = _target.GetVoice(128, 8);
Assert.AreEqual("Room Kit", _result3); // bank:128, prog:8
AreEqual("Room Kit", _result3); // bank:128, prog:8
}
}
}
81 changes: 41 additions & 40 deletions MidiPlayerTests/StandardMidiFileTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

using Microsoft.VisualStudio.TestTools.UnitTesting;
using static Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
using System.Collections.Generic;

namespace MidiPlayer.Midi.Test {
Expand All @@ -10,23 +11,23 @@ public void getTrackNameAndMidiChannelTest1() {
var _target = new StandardMidiFile("../data/Cmon_v1.mid");
var _private = new PrivateObject(_target);
var _result0 = _private.Invoke("getTrackNameAndMidiChannel", 0);
Assert.AreEqual(("Cmon", -1), _result0);
AreEqual(("Cmon", -1), _result0);
var _result1 = _private.Invoke("getTrackNameAndMidiChannel", 1);
Assert.AreEqual(("Vocal Main", 13), _result1);
AreEqual(("Vocal Main", 13), _result1);
var _result2 = _private.Invoke("getTrackNameAndMidiChannel", 2);
Assert.AreEqual(("Vocal Cho", 0), _result2);
AreEqual(("Vocal Cho", 0), _result2);
var _result3 = _private.Invoke("getTrackNameAndMidiChannel", 3);
Assert.AreEqual(("Synth Sqe", 15), _result3);
AreEqual(("Synth Sqe", 15), _result3);
var _result4 = _private.Invoke("getTrackNameAndMidiChannel", 4);
Assert.AreEqual(("Synth Pad", 14), _result4);
AreEqual(("Synth Pad", 14), _result4);
var _result5 = _private.Invoke("getTrackNameAndMidiChannel", 5);
Assert.AreEqual(("Guiter Riff", 12), _result5);
AreEqual(("Guiter Riff", 12), _result5);
var _result6 = _private.Invoke("getTrackNameAndMidiChannel", 6);
Assert.AreEqual(("Bass", 11), _result6);
AreEqual(("Bass", 11), _result6);
var _result7 = _private.Invoke("getTrackNameAndMidiChannel", 7);
Assert.AreEqual(("Drum OverTop", 9), _result7);
AreEqual(("Drum OverTop", 9), _result7);
var _result8 = _private.Invoke("getTrackNameAndMidiChannel", 8);
Assert.AreEqual(("Durm SN & BD", 9), _result8);
AreEqual(("Durm SN & BD", 9), _result8);
}

[TestMethod()]
Expand All @@ -41,15 +42,15 @@ public void getTrackNameAndMidiChannelTest2() {
public void TrackCountTest1() {
var _target = new StandardMidiFile("../data/Cmon_v1.mid");
var _result = _target.TrackCount;
Assert.AreEqual(8, _result);
AreEqual(8, _result);
}

[TestMethod()]
public void trackCountIncludeConductorTrackTest1() {
var _target = new StandardMidiFile("../data/Cmon_v1.mid");
var _private = new PrivateObject(_target);
var _result = _private.Invoke("trackCountIncludeConductorTrack");
Assert.AreEqual(9, _result);
AreEqual(9, _result);
}

[TestMethod()]
Expand All @@ -63,73 +64,73 @@ public void MidiChannelListTest1() {
public void GetTrackNameTest1() {
var _target = new StandardMidiFile("../data/Cmon_v1.mid");
var _result1 = _target.GetTrackName(1);
Assert.AreEqual("Vocal Main", _result1);
AreEqual("Vocal Main", _result1);
var _result2 = _target.GetTrackName(2);
Assert.AreEqual("Vocal Cho", _result2);
AreEqual("Vocal Cho", _result2);
var _result3 = _target.GetTrackName(3);
Assert.AreEqual("Synth Sqe", _result3);
AreEqual("Synth Sqe", _result3);
var _result4 = _target.GetTrackName(4);
Assert.AreEqual("Synth Pad", _result4);
AreEqual("Synth Pad", _result4);
var _result5 = _target.GetTrackName(5);
Assert.AreEqual("Guiter Riff", _result5);
AreEqual("Guiter Riff", _result5);
var _result6 = _target.GetTrackName(6);
Assert.AreEqual("Bass", _result6);
AreEqual("Bass", _result6);
var _result7 = _target.GetTrackName(7);
Assert.AreEqual("Drum OverTop", _result7);
AreEqual("Drum OverTop", _result7);
var _result8 = _target.GetTrackName(8);
Assert.AreEqual("Durm SN & BD", _result8);
AreEqual("Durm SN & BD", _result8);
}

[TestMethod()]
public void GetTrackNameTest2() {
var _target = new StandardMidiFile("../data/Tornado_v2.mid");
var _result0 = _target.GetTrackName(0);
Assert.AreEqual("Tornado", _result0);
AreEqual("Tornado", _result0);
var _result1 = _target.GetTrackName(1);
Assert.AreEqual("Bass", _result1);
AreEqual("Bass", _result1);
var _result2 = _target.GetTrackName(2);
Assert.AreEqual("Seque", _result2);
AreEqual("Seque", _result2);
var _result3 = _target.GetTrackName(3);
Assert.AreEqual("Pad", _result3);
AreEqual("Pad", _result3);
var _result4 = _target.GetTrackName(4);
Assert.AreEqual("Melody", _result4);
AreEqual("Melody", _result4);
var _result5 = _target.GetTrackName(5);
Assert.AreEqual("Drum", _result5);
AreEqual("Drum", _result5);
}

[TestMethod()]
public void GetTrackNameTest3() {
var _target = new StandardMidiFile("../data/ABC_v1.mid");
var _result0 = _target.GetTrackName(0);
Assert.AreEqual("ABC", _result0);
AreEqual("ABC", _result0);
var _result1 = _target.GetTrackName(1);
Assert.AreEqual("Brass1", _result1);
AreEqual("Brass1", _result1);
var _result2 = _target.GetTrackName(2);
Assert.AreEqual("Brass2", _result2);
AreEqual("Brass2", _result2);
var _result3 = _target.GetTrackName(3);
Assert.AreEqual("Melody Main", _result3);
AreEqual("Melody Main", _result3);
var _result4 = _target.GetTrackName(4);
Assert.AreEqual("Synth Reff", _result4);
AreEqual("Synth Reff", _result4);
var _result5 = _target.GetTrackName(5);
Assert.AreEqual("Synth Pad2", _result5);
AreEqual("Synth Pad2", _result5);
var _result6 = _target.GetTrackName(6);
Assert.AreEqual("Synth Pad1", _result6);
AreEqual("Synth Pad1", _result6);
var _result7 = _target.GetTrackName(7);
Assert.AreEqual("DX Reff", _result7);
AreEqual("DX Reff", _result7);
var _result8 = _target.GetTrackName(8);
Assert.AreEqual("Drum Main", _result8);
AreEqual("Drum Main", _result8);
var _result9 = _target.GetTrackName(9);
Assert.AreEqual("Percussion1", _result9);
AreEqual("Percussion1", _result9);
var _result10 = _target.GetTrackName(10);
Assert.AreEqual("Percussion2", _result10);
AreEqual("Percussion2", _result10);
var _result11 = _target.GetTrackName(11);
Assert.AreEqual("Bass", _result11);
AreEqual("Bass", _result11);
var _result12 = _target.GetTrackName(12);
Assert.AreEqual("Bass over dub", _result12);
AreEqual("Bass over dub", _result12);
var _result13 = _target.GetTrackName(13);
Assert.AreEqual("DX Sequence", _result13);
AreEqual("DX Sequence", _result13);
var _result14 = _target.GetTrackName(14);
Assert.AreEqual("Orchestral Hit", _result14);
AreEqual("Orchestral Hit", _result14);
}
}
}
21 changes: 11 additions & 10 deletions MidiPlayerTests/SynthTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

using Microsoft.VisualStudio.TestTools.UnitTesting;
using static Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
using System;
using System.Threading.Tasks;
using static System.Threading.Thread;
Expand All @@ -10,61 +11,61 @@ public class SynthTests {
[TestMethod()]
public void GetBankTest1() {
var _result = Synth.GetBank(0);
Assert.AreEqual(0, _result);
AreEqual(0, _result);
}

[TestMethod()]
public void GetBankTest2() {
var _result = Synth.GetBank(7);
Assert.AreEqual(128, _result);
AreEqual(128, _result);
}

[TestMethod()]
public void GetProgramTest1() {
var _result = Synth.GetProgram(1);
Assert.AreEqual(58, _result);
AreEqual(58, _result);
}

[TestMethod()]
public void GetProgramTest2() {
var _result = Synth.GetProgram(8);
Assert.AreEqual(16, _result);
AreEqual(16, _result);
}

[TestMethod()]
public void GetVoiceTest1() {
var _result = Synth.GetVoice(1);
Assert.AreEqual("Tuba", _result);
AreEqual("Tuba", _result);
}

[TestMethod()]
public void GetVoiceTest2() {
var _result = Synth.GetVoice(8);
Assert.AreEqual("Power Kit", _result);
AreEqual("Power Kit", _result);
}

[TestMethod()]
public void GetVoiceTest3() {
var _result = Synth.GetVoice(4);
Assert.AreEqual("Warm Pad", _result);
AreEqual("Warm Pad", _result);
}

[TestMethod()]
public void GetTrackNameTest1() {
var _result = Synth.GetTrackName(0);
Assert.AreEqual("Cmon", _result);
AreEqual("Cmon", _result);
}

[TestMethod()]
public void GetTrackNameTest2() {
var _result = Synth.GetTrackName(6);
Assert.AreEqual("Bass", _result);
AreEqual("Bass", _result);
}

[TestMethod()]
public void GetTrackNameTest3() {
var _result = Synth.GetTrackName(7);
Assert.AreEqual("Drum OverTop", _result);
AreEqual("Drum OverTop", _result);
}

[TestInitialize]
Expand Down

0 comments on commit 95de7cc

Please sign in to comment.