Esempio n. 1
0
        public async Task ICS_Parses_Entire_Data_file()
        {
            // Arrange

            // Load a data file
            var testFile         = @"RawData" + Path.DirectorySeparatorChar + "Alfouhk.simc";
            var testFileContents = await File.ReadAllLinesAsync(testFile);

            var testFileString = new List <string>(testFileContents);

            // Create a new item creation service
            var simcParser    = new SimcParserService(_loggerFactory.CreateLogger <SimcParserService>());
            var parsedProfile = simcParser.ParseProfileAsync(testFileString);

            // Act
            var items = new List <SimcItem>();

            foreach (var parsedItemData in parsedProfile.Items)
            {
                var item = await _ics.CreateItemAsync(parsedItemData);

                items.Add(item);
            }

            // Assert
            Assert.IsNotNull(items);
            Assert.NotZero(items.Count);
        }
Esempio n. 2
0
        public async Task InitOnce()
        {
            // Configure Logging
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Verbose()
                         .Enrich.FromLogContext()
                         .WriteTo.File("logs" + Path.DirectorySeparatorChar + "SimcProfileParser.log", rollingInterval: RollingInterval.Day)
                         .CreateLogger();

            // Load a data file
            var testFile         = @"RawData" + Path.DirectorySeparatorChar + "Hierophant.simc";
            var testFileContents = await File.ReadAllLinesAsync(testFile);

            var testFileString = new List <string>(testFileContents);

            // Create a new profile service
            using var loggerFactory = LoggerFactory.Create(builder => builder
                                                           .AddSerilog()
                                                           .AddFilter(level => level >= LogLevel.Trace));
            var logger     = loggerFactory.CreateLogger <SimcParserService>();
            var simcParser = new SimcParserService(logger);

            ParsedProfile = simcParser.ParseProfileAsync(testFileString);
        }