using System;
namespace mirrors
{
class Program
{
delegate void GetMessage();
static void Main(string[] args)
{
{
Console.WriteLine("введiть будь який текст");
string input = Console.ReadLine();
string output = Reverse(input);
Console.WriteLine("mirror text");
Console.WriteLine(output);
Console.Read();
}
}
public static string Reverse(string s)
{
{
char[] charArray = s.ToCharArray();
Array.Reverse(charArray);
return new string(charArray);
}
}
}
}
最常见的方法之一是 Arrange-Act-Assert 技术:
以下是基于 nUnit 框架的 AAA 方法的示例:
您没有 Arrange 阶段,因为您有一个静态类。
您还可以为您的方法接收 null 作为输入的情况编写测试。在您当前的代码中,您将收到 NullReferenceException - 或者您应该返回 null 或抛出您自己的异常。
相关链接: