コード例 #1
0
        public void FahClientLog_AddCustomDataToClientRunData_Test()
        {
            // Arrange
            var log = new CustomFahClientLog();

            using (var textReader = new StreamReader("..\\..\\..\\TestFiles\\Client_v7_14\\log.txt"))
                using (var reader = new FahClientLogTextReader(textReader))
                {
                    // Act
                    log.Read(reader);
                }
            var clientRun = log.ClientRuns.Last();

            var allProjectIDs = clientRun.SlotRuns
                                .Select(x => x.Value)
                                .SelectMany(x => x.UnitRuns)
                                .Select(x => x.Data.ProjectID)
                                .ToList();

            System.Diagnostics.Debug.WriteLine("Total Number of Project IDs: {0}", allProjectIDs.Count);
            var customData = (CustomClientRunData)clientRun.Data;

            System.Diagnostics.Debug.WriteLine("Unique Number of Project IDs: {0}", customData.UniqueProjectIDs.Count);
            foreach (var projectID in customData.UniqueProjectIDs)
            {
                System.Diagnostics.Debug.WriteLine(projectID);
            }
            // Assert
            Assert.AreNotEqual(allProjectIDs.Count, customData.UniqueProjectIDs.Count);
        }
コード例 #2
0
 /// <summary>
 /// Reads the log file from the given path and returns a new <see cref="FahClientLog"/> object.
 /// </summary>
 /// <param name="stream">A stream containing the log file text.</param>
 /// <returns>A new <see cref="FahClientLog"/> object.</returns>
 public static FahClientLog Read(Stream stream)
 {
     using (var textReader = new StreamReader(stream))
         using (var reader = new FahClientLogTextReader(textReader))
         {
             var log = new FahClientLog();
             log.Read(reader);
             return(log);
         }
 }
コード例 #3
0
        /// <summary>
        /// Reads the log file asynchronously from the given path and returns a new <see cref="FahClientLog"/> object.
        /// </summary>
        /// <param name="stream">A stream containing the log file text.</param>
        /// <returns>A new <see cref="FahClientLog"/> object.</returns>
        public static async Task <FahClientLog> ReadAsync(Stream stream)
        {
            using (var textReader = new StreamReader(stream))
                using (var reader = new FahClientLogTextReader(textReader))
                {
                    var log = new FahClientLog();
                    await log.ReadAsync(reader).ConfigureAwait(false);

                    return(log);
                }
        }
コード例 #4
0
 public void FahClientLogTextReader_ReadLine_FromLogIncludingHexCharacterRepresentations_Test()
 {
     using (var textReader = new StreamReader(TestDataReader.ReadStream("Client_v7_fr-FR_log.txt")))
         using (var reader = new FahClientLogTextReader(textReader))
         {
             LogLine logLine;
             while ((logLine = reader.ReadLine()) != null)
             {
                 Assert.IsNotNull(logLine);
                 Debug.WriteLine(logLine);
             }
         }
 }
コード例 #5
0
 public async Task FahClientLogTextReader_ReadLineAsync_Test()
 {
     using (var textReader = new StreamReader(TestDataReader.ReadStream("Client_v7_10_log.txt")))
         using (var reader = new FahClientLogTextReader(textReader))
         {
             LogLine logLine;
             while ((logLine = await reader.ReadLineAsync()) != null)
             {
                 Assert.IsNotNull(logLine);
                 Debug.WriteLine(logLine);
             }
         }
 }
コード例 #6
0
        public async Task FahClientLog_ReadAsync_FromFahLogReader_Test()
        {
            // Arrange
            var log = new FahClientLog();

            using (var textReader = new StreamReader(TestDataReader.ReadStream("Client_v7_10_log.txt")))
                using (var reader = new FahClientLogTextReader(textReader))
                {
                    // Act
                    await log.ReadAsync(reader);
                }
            // Assert
            Assert.IsTrue(log.ClientRuns.Count > 0);
        }
コード例 #7
0
        public void FahClientLog_Clear_Test()
        {
            // Arrange
            var log = new FahClientLog();

            using (var textReader = new StreamReader(TestDataReader.ReadStream("Client_v7_10_log.txt")))
                using (var reader = new FahClientLogTextReader(textReader))
                {
                    log.Read(reader);
                }
            Assert.IsTrue(log.ClientRuns.Count > 0);
            // Act
            log.Clear();
            // Assert
            Assert.AreEqual(0, log.ClientRuns.Count);
        }