[英]Develop C# code using the method.Develop a UNIT-test to verify the method works
將文本的每個句子按單詞中元音數量的升序編寫。錯誤:“Letters”方法的重載都不接受 arguments“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() {}
)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.