コード例 #1
0
        public void IFileFeedParser_for_json_should_fire_exception_for_wrong_file_path()
        {
            var fileProcessManager = _serviceProvider.GetRequiredService <FileProcessManager>();

            IFileFeedParser fileProcessor = fileProcessManager.GetFileProcessor(_jsonFilePath);

            Assert.Throws <FileNotFoundException>(() => fileProcessor.ProcessFileAndGetRaceInfo(fullFilePath: "./wrongFIle.json"));
        }
コード例 #2
0
        public void IFileFeedParser_for_json_should_fire_exception_for_empty_file_string()
        {
            var fileProcessManager = _serviceProvider.GetRequiredService <FileProcessManager>();

            IFileFeedParser fileProcessor = fileProcessManager.GetFileProcessor(_jsonFilePath);

            Assert.Throws <ArgumentNullException>(() => fileProcessor.ProcessFileAndGetRaceInfo(fullFilePath: ""));
        }
コード例 #3
0
        public void di_get_json_file_parser_for_file_extension_json()
        {
            var fileProcessManager = _serviceProvider.GetRequiredService <FileProcessManager>();

            IFileFeedParser fileProcessor = fileProcessManager.GetFileProcessor(_jsonFilePath);

            Assert.NotNull(fileProcessor);
            Assert.StrictEqual(typeof(JsonFileFeedParser), fileProcessor.GetType());
        }
コード例 #4
0
        public void IFileFeedParser_for_json_should_return_valid_race_object_with_2_horses()
        {
            var fileProcessManager = _serviceProvider.GetRequiredService <FileProcessManager>();

            IFileFeedParser    fileProcessor = fileProcessManager.GetFileProcessor(_jsonFilePath);
            FileInfo           fi            = new FileInfo(_jsonFilePath);
            ICollection <Race> races         = fileProcessor.ProcessFileAndGetRaceInfo(fullFilePath: fi.FullName);

            Assert.NotNull(races);
            Assert.Equal(1, races.Count);
            Assert.Equal(2, races.First().Horses.Count);
        }