-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathUnitTest1.cs
More file actions
40 lines (34 loc) · 898 Bytes
/
Copy pathUnitTest1.cs
File metadata and controls
40 lines (34 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using NUnit.Framework;
using EchoServer;
namespace EchoServerTests;
[TestFixture]
public class EchoProcessorTests
{
private EchoProcessor _processor;
[SetUp]
public void Setup()
{
_processor = new EchoProcessor();
}
[Test]
public void Process_ValidMessage_ReturnsSameMessage()
{
string input = "Hello, SDR!";
string result = _processor.Process(input);
Assert.That(result, Is.EqualTo(input));
}
[Test]
[TestCase("")]
[TestCase(" ")]
public void Process_InvalidMessage_ReturnsEmptyString(string input)
{
string result = _processor.Process(input);
Assert.That(result, Is.EqualTo(string.Empty));
}
[Test]
public void Process_NullMessage_ReturnsEmptyString()
{
string result = _processor.Process(null!);
Assert.That(result, Is.EqualTo(string.Empty));
}
}