public void SortNamesTest() { List <PersonDetail> sortedTestList = new List <PersonDetail>(); sortedTestList.Add(new PersonDetail { GivenName = "Jeff", LastName = "Bezos" }); sortedTestList.Add(new PersonDetail { GivenName = "Bill", LastName = "Gates" }); sortedTestList.Add(new PersonDetail { GivenName = "Elon", LastName = "Musk" }); NameSorter nameSorter = new NameSorter(); nameSorter._nameList.Add(new PersonDetail { GivenName = "Elon", LastName = "Musk" }); nameSorter._nameList.Add(new PersonDetail { GivenName = "Bill", LastName = "Gates" }); nameSorter._nameList.Add(new PersonDetail { GivenName = "Jeff", LastName = "Bezos" }); nameSorter.SortNames(); sortedTestList.Should().BeEquivalentTo(nameSorter.GetNames()); }
public void ReadFile_StoresNames_Test() { List <PersonDetail> testList = new List <PersonDetail>(); testList.Add(new PersonDetail { GivenName = "Jeff", LastName = "Bezos" }); testList.Add(new PersonDetail { GivenName = "Bill", LastName = "Gates" }); testList.Add(new PersonDetail { GivenName = "Elon", LastName = "Musk" }); NameSorter nameSorter = new NameSorter(); nameSorter.FileName = @"D:\CSharpPractice\GlobalX\unsorted-names-test.txt"; nameSorter.ReadFile(); testList.Should().BeEquivalentTo(nameSorter.GetNames()); }