aboutsummaryrefslogtreecommitdiff
path: root/Oscilloscope/OscilloscopeTests
diff options
context:
space:
mode:
authorSyndamia <kami02882@gmail.com>2019-09-08 02:13:49 +0300
committerSyndamia <kami02882@gmail.com>2019-09-08 02:13:49 +0300
commit0b4849692ff13eb313d9cbf4e570cb842fde1047 (patch)
tree5ab5f8cb4b75d15998bc244c18ae05922f5dd420 /Oscilloscope/OscilloscopeTests
parentb2993028499dd994caf5e2a5bf362f3116416ae6 (diff)
downloadShower-0b4849692ff13eb313d9cbf4e570cb842fde1047.tar
Shower-0b4849692ff13eb313d9cbf4e570cb842fde1047.tar.gz
Shower-0b4849692ff13eb313d9cbf4e570cb842fde1047.zip
Added Wave.cs tests (and fixed a Wave.cs problem)
Diffstat (limited to 'Oscilloscope/OscilloscopeTests')
-rw-r--r--Oscilloscope/OscilloscopeTests/WaveTests.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/Oscilloscope/OscilloscopeTests/WaveTests.cs b/Oscilloscope/OscilloscopeTests/WaveTests.cs
index aae4f17..f75634d 100644
--- a/Oscilloscope/OscilloscopeTests/WaveTests.cs
+++ b/Oscilloscope/OscilloscopeTests/WaveTests.cs
@@ -7,6 +7,28 @@ using System.Collections.Generic;
namespace OscilloscopeTests {
[TestFixture]
public class WaveTests {
-
+
+ [Test]
+ public static void InitialisationOverloadsNameCreaton() {
+ Wave wave1 = new Wave();
+ Wave wave2 = new Wave("My wave");
+
+ Assert.AreEqual("Wave1", wave1.Name, "Automatic wave name isn't working properly.");
+ Assert.AreEqual("My wave", wave2.Name, "Custom wave name from overload doesn't work correctly.");
+
+ var testException = Assert.Throws<ArgumentException>(() => new Wave(""));
+ Assert.AreEqual("Name cannot be empty string!", testException.Message, "There is no eception if you input an empty string as a name");
+ }
+
+ [Test]
+ public static void InitialisationWithAListOfValues() {
+ var testValues = new List<int>() { int.MinValue, int.MinValue + 1, 0, int.MaxValue - 1, int.MaxValue };
+ Wave testWave = new Wave(new List<int>() { int.MinValue, int.MinValue + 1, 0, int.MaxValue - 1, int.MaxValue});
+
+ for (int i = 0; i < 5; i++) {
+ Assert.AreEqual(testValues[i], testWave.GetValue(), $"Wave doesn't return right value (failed on value No {i})");
+ }
+ Assert.AreEqual(testValues[0], testWave.GetValue(), "Wave doesn't reset return index variable correctly.");
+ }
}
}