Write Unit test for sorting

Posted by user175084 on Stack Overflow See other posts from Stack Overflow or by user175084
Published on 2012-11-21T22:44:24Z Indexed on 2012/11/21 22:59 UTC
Read the original article Hit count: 167

Filed under:
|
|
|
|

I need to write a unit test for a method where I arrange data according to another default list.

This is the method.

internal AData[] GetDataArrayInInitialSortOrder(ABData aBData)
    {
        Dictionary<string,AData > aMap = aBData.ADataArray.ToDictionary(v => v.GroupName, v => v);
        List<AData> newDataList = new List<AData>();
        foreach (AData aData in _viewModel.ADList)
            newDataList.Add(aMap[aData.GroupName]);
        return newDataList.ToArray();
    }

Please help I am new in unit testing and this is not easy for me. Any sample or links are appreciated

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET