コード例 #1
0
        public void TestMap()
        {
            var data   = new DataForProcessing();
            var result = new List <KeyValuePair <string, int> >
            {
                new KeyValuePair <string, int>("Hello", 1),
                new KeyValuePair <string, int>("world", 1),
                new KeyValuePair <string, int>("Hello", 1),
                new KeyValuePair <string, int>("my", 1),
                new KeyValuePair <string, int>("friend", 1)
            };
            var actual = data.Map("Hello world! Hello my friend.");

            CollectionAssert.AreEqual(result, actual);
        }
コード例 #2
0
        public List <KeyValuePair <string, int> > ReceiveDataForMap(DataForProcessing testData, List <FileToProcessing> files, string type)
        {
            var    res    = new List <KeyValuePair <string, int> >();
            string result = null;

            foreach (var file in files)
            {
                result += '\n' + Encoding.UTF8.GetString(file.Content);
            }
            if (type == "mapper")
            {
                res = testData.Map(result);
            }
            Console.WriteLine("'Map' operation has finished");
            return(res);
        }