public void ParseFile_ValidStreamWith4Urls_ShouldReturn4Urls()
        {
            // arrange
            string[] args = new string[] {};
            var streamFactory = new Mock<IStreamFactory>();
            ProjectFileParser target = new ProjectFileParser(streamFactory.Object);
            IEnumerable<IProjectFileLineInfo> result;

            using (Stream file = new MemoryStream())
            {
                WriteStreamWith4Urls(file);

            // act
                result = target.ParseFile(file, args);
            }

            // assert
            var actual = result.Count();
            var expected = 4;

            Assert.AreEqual(expected, actual);
        }
        public void ParseFile_ValidFilePathWith4Urls_ShouldReturn4Urls()
        {
            // arrange
            string[] args = new string[] {};
            IEnumerable<IProjectFileLineInfo> result;
            using (Stream stream = new MemoryStream())
            {
                WriteStreamWith4Urls(stream);

                var streamFactory = new Mock<IStreamFactory>();
                streamFactory.Setup(x => x.GetFileStream(It.IsAny<string>(), It.IsAny<FileMode>(), It.IsAny<FileAccess>())).Returns(stream);
                ProjectFileParser target = new ProjectFileParser(streamFactory.Object);

                // act
                result = target.ParseFile(stream, args);
            }

            // assert
            var actual = result.Count();
            var expected = 4;

            Assert.AreEqual(expected, actual);
        }
        public void ParseLine_NullLine_ShouldReturnNullFileLineInfo()
        {
            // arrange
            string line = null;
            string[] args = new string[] { "www.google.com" };
            var streamFactory = new Mock<IStreamFactory>();
            ProjectFileParser target = new ProjectFileParser(streamFactory.Object);

            // act
            var result = target.ParseLine(line, args);

            // assert
            IProjectFileLineInfo actual = result;
            IProjectFileLineInfo expected = null;

            Assert.AreEqual(expected, actual);
        }
        public void ParseLine_ValidLine_ShouldReturnUrlFromLine()
        {
            // arrange
            string line = "http://www.google.com/\tsingle";
            string[] args = new string[0];
            var streamFactory = new Mock<IStreamFactory>();
            IProjectFileParser target = new ProjectFileParser(streamFactory.Object);

            // act
            var result = target.ParseLine(line, args);

            // assert
            var actual = result.Url;
            var expected = "http://www.google.com/";

            Assert.AreEqual(expected, actual);
        }
        public void ParseLine_LineUrlWithReplacementDomain_ShouldReturnUrlWithDomain()
        {
            // arrange
            string line = "http://{0}/test.aspx";
            string[] args = new string[] { "www.google.com" };
            var streamFactory = new Mock<IStreamFactory>();
            ProjectFileParser target = new ProjectFileParser(streamFactory.Object);

            // act
            var result = target.ParseLine(line, args);

            // assert
            var actual = result.Url;
            var expected = "http://www.google.com/test.aspx";

            Assert.AreEqual(expected, actual);
        }