Пример #1
0
            public void Should_Read_ComVisible(bool value, bool expected)
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.ComVisible = value;

                // When
                var result = fixture.Parse();

                // Then
                Assert.Equal(expected, result.ComVisible);
            }
Пример #2
0
            public void Should_Read_Configuration(string value, string expected)
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.Configuration = value;

                // When
                var result = fixture.Parse();

                // Then
                Assert.Equal(expected, result.Configuration);
            }
Пример #3
0
            public void Should_Throw_If_AssemblyInfo_Path_Is_Null()
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.Path = null;

                // When
                var result = Record.Exception(() => fixture.Parse());

                // Then
                AssertEx.IsArgumentNullException(result, "assemblyInfoPath");
            }
Пример #4
0
            public void Should_Read_Trademark(string value, string expected)
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.Trademark = value;

                // When
                var result = fixture.Parse();

                // Then
                Assert.Equal(expected, result.Trademark);
            }
Пример #5
0
            public void Should_Throw_If_AssemblyInfo_File_Do_Not_Exist()
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.CreateAssemblyInfo = false;

                // When
                var result = Record.Exception(() => fixture.Parse());

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Assembly info file '/Working/output.cs' does not exist.", result?.Message);
            }
Пример #6
0
            public void Should_Read_ClsCompliance(bool value, bool expected, bool extraWhiteSpaces)
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.ExtraWhiteSpaces = extraWhiteSpaces;
                fixture.ClsCompliant     = value;

                // When
                var result = fixture.Parse();

                // Then
                Assert.Equal(expected, result.ClsCompliant);
            }
Пример #7
0
            public void Should_Read_AssemblyVersion(string value, string expected, bool extraWhiteSpaces)
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.ExtraWhiteSpaces = extraWhiteSpaces;
                fixture.Version          = value;

                // When
                var result = fixture.Parse();

                // Then
                Assert.Equal(expected, result.AssemblyVersion);
            }
Пример #8
0
            public void Should_Read_CustomAttributes()
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.CustomAttributes = new List <AssemblyInfoCustomAttribute>
                {
                    new AssemblyInfoCustomAttribute {
                        Name = "FooA", NameSpace = "SomeFoos.Attributes", Value = "A Value"
                    },
                    new AssemblyInfoCustomAttribute {
                        Name = "FooB", NameSpace = "SomeFoos.Attributes", Value = true
                    }
                };

                // When
                var result = fixture.Parse();

                var assemblyInfoFixture = new AssemblyInfoFixture();

                assemblyInfoFixture.Settings = new AssemblyInfoSettings()
                {
                    CustomAttributes     = result.CustomAttributes,
                    CLSCompliant         = result.ClsCompliant,
                    Company              = result.Company,
                    ComVisible           = result.ComVisible,
                    Configuration        = result.Configuration,
                    Copyright            = result.Copyright,
                    Description          = result.Description,
                    FileVersion          = result.AssemblyFileVersion,
                    Guid                 = result.Guid,
                    InformationalVersion = result.AssemblyInformationalVersion,
                    InternalsVisibleTo   = result.InternalsVisibleTo,
                    Product              = result.Product,
                    Title                = result.Title,
                    Trademark            = result.Trademark,
                    Version              = result.AssemblyVersion
                };

                var result2 = assemblyInfoFixture.CreateAndReturnContent();

                // Then
                //Assert.Equal(2, result.InternalsVisibleTo.Count);
                //Assert.Equal("Cake.Core.Tests", result.InternalsVisibleTo.ElementAt(0));
                //Assert.Equal("Cake.Common.Tests", result.InternalsVisibleTo.ElementAt(1));
            }
Пример #9
0
            public void Should_Read_InternalsVisibleTo()
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.InternalsVisibleTo = new List <string>
                {
                    "Cake.Core.Tests",
                    "Cake.Common.Tests"
                };

                // When
                var result = fixture.Parse();

                // Then
                Assert.Equal(2, result.InternalsVisibleTo.Count);
                Assert.Equal("Cake.Core.Tests", result.InternalsVisibleTo.ElementAt(0));
                Assert.Equal("Cake.Common.Tests", result.InternalsVisibleTo.ElementAt(1));
            }
Пример #10
0
            public void Should_Read_FullyQualifiedAssemblyAttributes()
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.CreateAssemblyInfo = false;
                fixture.WithAssemblyInfoContents(Resources.FullyQualifiedAssemblyInfo.NormalizeLineEndings());

                // When
                var result = fixture.Parse();

                // Then
                Assert.Equal("FullyQualifiedCompanyAttribute", result.Company);
                Assert.Equal("FullyQualifiedConfigurationAttribute", result.Configuration);
                Assert.Equal("1.3.0.0", result.AssemblyFileVersion);
                Assert.Equal("1.3.0", result.AssemblyInformationalVersion);
                Assert.Equal("FullyQualifiedProductAttribute", result.Product);
                Assert.Equal("FullyQualifiedTitleAttribute", result.Title);
                Assert.Equal("1.3.0.0", result.AssemblyVersion);
            }
Пример #11
0
            public void Should_Correctly_Parse_MonoDevelop_AssemblyInfo_File()
            {
                // Given
                var fixture = new AssemblyInfoParserFixture();

                fixture.CreateAssemblyInfo = false;
                fixture.WithAssemblyInfoContents(Resources.MonoDevelopAssemblyInfo.NormalizeLineEndings());

                // When
                var result = fixture.Parse();

                // Then
                Assert.Equal(result.Title, "MonoDevelopAssemblyTitle");
                Assert.Equal(result.Description, "MonoDevelopAssemblyDescription");
                Assert.Equal(result.Configuration, "MonoDevelopConfiguration");
                Assert.Equal(result.Company, "MonoDevelopCompany");
                Assert.Equal(result.Product, "MonoDevelopProduct");
                Assert.Equal(result.Copyright, "MonoDevelopCopyright");
                Assert.Equal(result.Trademark, "MonoDevelopTrademark");
            }