コード例 #1
0
ファイル: ReducerTests.cs プロジェクト: pbazydlo/bluepath
        public void ReducerPerformsReduceOnLoadedFilesUsingExternalCode()
        {
            var keys = CreateTwoKeyFileSet(this.storage);

            TestHelpers.LoadToStorage(@"..\..\SampleReducer.cs", new FileUri("file:///SampleReducer.cs"), this.storage);
            var reduceProvider = Loader.Load<IReduceProvider>("SampleReducer.cs", this.storage);
            var reducer = new Reducer(keys[0], reduceProvider.Reduce, this.storage);

            var res = reducer.PerformReduce();

            res.Value.ShouldBe("3");
        }
コード例 #2
0
ファイル: ReducerTests.cs プロジェクト: pbazydlo/bluepath
        public void ReducerPerformsReduceOnLoadedFiles()
        {
            var keys = CreateTwoKeyFileSet(this.storage);
            var reducer = new Reducer(keys[0], (key, values) =>
            {
                int result = 0;
                foreach (var value in values)
                {
                    result += int.Parse(value);
                }

                return new KeyValuePair<string, string>(key, result.ToString());
            }, this.storage);

            var res = reducer.PerformReduce();

            res.Value.ShouldBe("3");
        }