使用该方法开发c#代码.开发一个单元测试来验证方法的有效性



按单词元音数升序写出文本的每个句子。错误:没有任何"字母"的重载。方法接受参数"1"

public class Vowels
{
public string Letters()
{
string[] a = { "aeiouy" };
Array.Sort(a);

}
}

单元测试:

[TestClass]
public class VowelsTests
{
[TestMethod]
public void MethodSort_vowels_in_ascending_order()
{
string a = "Teest! Test!";

string expected = "Test! Teest";

Vowels t = new Vowels();
int actual = t.Letters(a);

Assert.AreEqual(expected, actual);
}
}

您正在调用带有参数(t.Letters(a))的方法Letters(),但它没有定义任何参数(public string Letters() {})。

相关内容

最新更新