Пример #1
0
        public void MapperPerformsMapOperationUsingExternalCode()
        {
            var filePath = "file1.txt";
            var fileContent = "whatever am i";
            storage.Store(filePath, fileContent);

            TestHelpers.LoadToStorage(@"..\..\SampleMapper.cs", new FileUri("file:///SampleMapper.cs"), this.storage);
            var mapProvider = Loader.Load<IMapProvider>("SampleMapper.cs",this.storage);
            var mapper = new Mapper(filePath, mapProvider.Map, this.storage);

            var mapResult = mapper.PerformMap();

            mapResult.Count().ShouldBe(3);
        }
Пример #2
0
        public void MapperPerformsMapOperation()
        {
            var filePath = "file1.txt";
            var fileContent = "whatever am i";
            storage.Store(filePath, fileContent);

            var mapper = new Mapper(filePath, (key, value) =>
            {
                var result = new System.Collections.Generic.SortedList<string, string>();
                foreach (var w in value.Split(' '))
                    result.Add(w, "1");

                return result;
            }, this.storage);

            var mapResult = mapper.PerformMap();

            mapResult.Count().ShouldBe(3);
        }