Пример #1
0
        public static void ParseFileContent_ReturnsExpectedResult()
        {
            var content = Helpers.ReadResourceFile("AssemblyInfo.cs.txt");

            var result = AssemblyInfoParser.ParseFileContent(content).ToArray();

            Assert.That(result, Is.Not.Null);

            Assert.Multiple(
                () =>
            {
                Assert.That(result.Length, Is.EqualTo(7));

                Assert.That(
                    result.FirstOrDefault(
                        x => x.Key.Equals(
                            "System.Reflection.AssemblyFileVersionAttribute",
                            StringComparison.CurrentCultureIgnoreCase))
                    .Value,
                    Is.EqualTo("1.2.3.4"));
                Assert.That(
                    result.FirstOrDefault(
                        x => x.Key.Equals(
                            "System.Reflection.AssemblyVersionAttribute",
                            StringComparison.CurrentCultureIgnoreCase))
                    .Value,
                    Is.EqualTo("4.3.2.1"));
            }
                );
        }
Пример #2
0
        private void ProcessAssemblyInfo(Project projectMetadata, SourceInformation projectDirectory)
        {
            _logger.Trace("Entering");

            var propertiesInfo = Tools.GetChildDirectoryInformation(
                new SourceInformation(projectDirectory),
                "properties");
            // ReSharper disable once StringLiteralTypo
            var assemblyInfo = Tools.GetChildFileInformation(propertiesInfo, "assemblyinfo.cs");

            var sourceTool = GetSourceTool();

            var sw      = Stopwatch.StartNew();
            var content = sourceTool.GetItemContent(assemblyInfo);

            sw.Stop();
            _logger.Trace($"GetItemContent took {sw.Elapsed}");

            if (content != null)
            {
                projectMetadata.AssemblyInformation = AssemblyInfoParser.ParseFileContent(content).ToList();
            }
        }
Пример #3
0
 public static void ParseFileContent_Throws(string input)
 {
     Assert.Throws <ArgumentException>(() => AssemblyInfoParser.ParseFileContent(input));
 }