Exemplo n.º 1
0
 public void FahClientLog_ReadAsync_ThrowsWhenFahLogReaderIsNull_Test()
 {
     Assert.ThrowsAsync <ArgumentNullException>(async() =>
     {
         FahLog log = new FahClientLog();
         await log.ReadAsync(null);
     });
 }
Exemplo n.º 2
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);
                }
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public async Task FahClientLog_ReadAsync_FromPath_Test()
        {
            using (var artifacts = new ArtifactFolder())
            {
                var path = artifacts.GetRandomFilePath();
                using (var stream = File.OpenWrite(path))
                {
                    await TestDataReader.ReadStream("Client_v7_10_log.txt").CopyToAsync(stream);
                }

                var log = await FahClientLog.ReadAsync(path);

                Assert.IsTrue(log.ClientRuns.Count > 0);
            }
        }
Exemplo n.º 5
0
        public async Task FahClientLog_ReadAsync_FromStream_Test()
        {
            var log = await FahClientLog.ReadAsync(TestDataReader.ReadStream("Client_v7_10_log.txt"));

            Assert.IsTrue(log.ClientRuns.Count > 0);
        }