public void ShouldBuildString() { var builder = new CSharpAssemblyInfoBuilder(); var details = new AssemblyInfoDetails(builder).ComVisible(false).ClsCompliant(false).Version("1.0.0.0").Title("asmTitle").Description("asmDesc").Copyright("asmCopyright").Company("Company").Product("My Product"); var sb = new StringBuilder(); sb.AppendLine("using System;"); sb.AppendLine("using System.Reflection;"); sb.AppendLine("using System.Runtime.InteropServices;"); sb.AppendLine("[assembly: ComVisible(false)]"); sb.AppendLine("[assembly: CLSCompliant(false)]"); sb.AppendLine("[assembly: AssemblyVersionAttribute(\"1.0.0.0\")]"); sb.AppendLine("[assembly: AssemblyTitleAttribute(\"asmTitle\")]"); sb.AppendLine("[assembly: AssemblyDescriptionAttribute(\"asmDesc\")]"); sb.AppendLine("[assembly: AssemblyCopyrightAttribute(\"asmCopyright\")]"); sb.AppendLine("[assembly: AssemblyCompanyAttribute(\"Company\")]"); sb.AppendLine("[assembly: AssemblyProductAttribute(\"My Product\")]"); //sb.AppendFormat("[assembly: ApplicationNameAttribute(\"{0}\")]{1}", details._applicationName, Environment.NewLine); // sb.AppendFormat("[assembly: AssemblyCompany(\"{0}\")]{1}", details.AssemblyCompany, Environment.NewLine); // sb.AppendFormat("[assembly: AssemblyProduct(\"{0}\")]{1}", details.AssemblyProduct, Environment.NewLine); Assert.That(builder.Build(details).Trim(), Is.EqualTo(sb.ToString().Trim())); }
public void ShouldHanldeOutputPath() { var subject = new AssemblyInfoDetails(new CSharpAssemblyInfoBuilder()); subject.OutputPath(new File("temp")); Assert.That(subject._outputPath, Is.EqualTo("temp")); }
public void ShouldHandleAllDefaultAttributes() { var subject = new AssemblyInfoDetails(new CSharpAssemblyInfoBuilder()); subject.Company("").Copyright("").Description("").Product("").Title("") .Version("1.0.0.0").Culture("").DelaySign(true).FileVersion("1.0.0.0") .InformationalVersion("1.0.0.0").KeyFile("").KeyName("").Trademark(""); }
public void ShouldHanldeCustomAttribute() { var subject = new AssemblyInfoDetails(new CSharpAssemblyInfoBuilder()); subject.AddCustomAttribute("Namespace", "Name", true, "Value"); Assert.That(subject.Imports.Contains("Namespace")); Assert.That(subject.LineItems[0].Name, Is.EqualTo("Name")); Assert.That(subject.LineItems[0].Value, Is.EqualTo("Value")); }
public void ImportShouldNotAllowDuplicates() { var subject = new AssemblyInfoDetails(new CSharpAssemblyInfoBuilder()); Assert.That(subject.Imports.Count, Is.EqualTo(0)); subject.Import("test"); subject.Import("test"); Assert.That(subject.Imports.Count, Is.EqualTo(1)); }
public void ShouldWriteToMemory() { var mock = MockRepository.GenerateStub<IFileSystemHelper>(); var subject = new AssemblyInfoDetails(new CSharpAssemblyInfoBuilder(), mock); var outputpath = "IDONTEXIST"; var inMemoryFile = new MemoryStream(); mock.Stub(x => x.CreateFile(outputpath)).Return(inMemoryFile); ((AssemblyInfoDetails)subject.Copyright("TEST").OutputPath(outputpath)).InternalExecute(); Assert.That(inMemoryFile.GetBuffer().Length, Is.GreaterThan(0)); }
public void ShouldWriteToMemory() { var mock = MockRepository.GenerateStub <IFileSystemHelper>(); var subject = new AssemblyInfoDetails(new CSharpAssemblyInfoBuilder(), mock); var outputpath = "IDONTEXIST"; var inMemoryFile = new MemoryStream(); mock.Stub(x => x.CreateFile(outputpath)).Return(inMemoryFile); ((AssemblyInfoDetails)subject.Copyright("TEST").OutputPath(outputpath)).InternalExecute(); Assert.That(inMemoryFile.GetBuffer().Length, Is.GreaterThan(0)); }
public void ShouldBuildString() { var builder = new VisualBasicAssemblyInfoBuilder(); var details = new AssemblyInfoDetails(builder).ComVisible(false).ClsCompliant(false).Version("1.0.0.0").Title("asmTitle").Description("asmDesc").Copyright("asmCopyright"); var sb = new StringBuilder(); sb.AppendLine("imports System"); sb.AppendLine("imports System.Reflection"); sb.AppendLine("imports System.Runtime.InteropServices"); sb.AppendLine("<assembly: ComVisible(false)>"); sb.AppendLine("<assembly: CLSCompliant(false)>"); sb.AppendLine("<assembly: AssemblyVersionAttribute(\"1.0.0.0\")>"); sb.AppendLine("<assembly: AssemblyTitleAttribute(\"asmTitle\")>"); sb.AppendLine("<assembly: AssemblyDescriptionAttribute(\"asmDesc\")>"); sb.AppendLine("<assembly: AssemblyCopyrightAttribute(\"asmCopyright\")>"); Assert.That(builder.Build(details).Trim(), Is.EqualTo(sb.ToString().Trim())); }
public void ShouldHanldeOutputPath() { var subject = new AssemblyInfoDetails(new CSharpAssemblyInfoBuilder()); subject.OutputPath(new File("temp")); Assert.That(subject._outputPath,Is.EqualTo("temp")); }