/// <summary> /// Called when the <c>TestProjectBuilder</c> is about to create the code generator. /// </summary> /// <param name="codeNamespace">The code namespace.</param> /// <param name="configuration">The configuration.</param> /// <param name="buildSystem">The build system.</param> /// <returns>An with the parameters initialized code generator.</returns> /// <remarks>Override this method to instantiate others than the standard generators. /// <example>The default implementation is: /// <code><![CDATA[ /// protected virtual ICodeGenerator OnCreateCodeGenerator(CodeNamespace codeNamespace, CodeGeneratorParameters configuration, IBuildSystem buildSystem) /// { /// var codeGenerator = this.createGeneratorCallback(buildSystem, configuration, codeNamespace); /// return codeGenerator; /// } /// ]]></code></example> /// </remarks> protected virtual ICodeGenerator OnCreateCodeGenerator( CodeNamespace codeNamespace, ICodeGeneratorParameters configuration, IBuildSystem buildSystem) { var codeGenerator = this.createGeneratorCallback(buildSystem, configuration, codeNamespace); return(codeGenerator); }
/// <summary> /// Called when the <c>TestProjectBuilder</c> is about to create the code generator. /// </summary> /// <param name="codeNamespace">The code namespace.</param> /// <param name="configuration">The configuration.</param> /// <param name="buildSystem">The build system.</param> /// <returns> /// An with the parameters initialized code generator. /// </returns> protected override ICodeGenerator OnCreateCodeGenerator( CodeNamespace codeNamespace, ICodeGeneratorParameters configuration, IBuildSystem buildSystem) { var codeGenerator = this.createGeneratorCallback(buildSystem, this.properties, configuration, codeNamespace); return(codeGenerator); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpMbUnitCodeGenerator"/> class /// based the given <see cref="CodeNamespace"/> which will output to the given directory. /// </summary> /// <param name="buildSystem">The build system.</param> /// <param name="codeNamespace">The code namespace.</param> /// <param name="testBuilders">The test builder repository.</param> /// <param name="configuration">The configuration of the generator.</param> /// <exception cref="System.ArgumentNullException"><paramref name="codeNamespace"/> or /// <cref name="ICodeGeneratorParameters.OutputDirectory"/> is <c>null</c>.</exception> /// <exception cref="System.ArgumentException"><cref name="ICodeGeneratorParameters.OutputDirectory"/> is an /// empty string.</exception> /// <exception cref="System.ApplicationException"><cref name="ICodeGeneratorParameters.OutputDirectory"/> /// cannot be found.</exception> public CSharpMbUnitCodeGenerator( IBuildSystem buildSystem, CodeNamespace codeNamespace, IMemberBuilderFactory testBuilders, ICodeGeneratorParameters configuration) : base(buildSystem, codeNamespace, testBuilders, configuration) { }
/// <summary> /// Initializes a new instance of the <see cref="CSharpMbUnitRhinoMocksCodeGenerator"/> class /// based the given <see cref="CodeNamespace"/> which will output to the given directory. /// </summary> /// <param name="buildSystem">The build system.</param> /// <param name="codeNamespace">The code namespace.</param> /// <param name="testBuilders">The test builder repository.</param> /// <param name="configuration">The configuration of the generator.</param> /// <exception cref="System.ArgumentNullException"><paramref name="codeNamespace"/> or /// <cref name="ICodeGeneratorParameters.OutputDirectory"/> is <c>null</c>.</exception> /// <exception cref="System.ArgumentException"><cref name="ICodeGeneratorParameters.OutputDirectory"/> is an /// empty string.</exception> /// <exception cref="ApplicationException"><cref name="ICodeGeneratorParameters.OutputDirectory"/> /// cannot be found.</exception> public CSharpMbUnitRhinoMocksCodeGenerator( IBuildSystem buildSystem, CodeNamespace codeNamespace, IMemberBuilderFactory testBuilders, ICodeGeneratorParameters configuration) : base(buildSystem, codeNamespace, testBuilders, configuration) { }
/// <summary> /// Initializes a new instance of the <see cref="LoadAssemblyWorker"/> class. /// </summary> /// <param name="buildSystem">The build system.</param> /// <param name="buildData">The build properties data storage.</param> /// <param name="mainform">The application main window.</param> public LoadAssemblyWorker(IBuildSystem buildSystem, IBuildDataDictionary buildData, MainForm mainform) { Guard.NotNull(() => buildSystem, buildSystem); this.buildSystem = buildSystem; Guard.NotNull(() => buildData, buildData); this.buildData = buildData; Guard.NotNull(() => mainform, mainform); this.mainform = mainform; }
/// <summary> /// Initializes a new instance of the <see cref="CSharpProjectGenerator"/> class /// within the given <paramref name="projectName"/> which will output to the given /// <paramref name="outputDirectory"/>. /// </summary> /// <param name="buildSystem">The build system.</param> /// <param name="projectName">The name of the project.</param> /// <param name="outputDirectory">The directory where the project /// will be output.</param> /// <exception cref="System.ArgumentNullException">Either <paramref name="projectName"/> or /// <paramref name="outputDirectory"/> is <c>null</c>.</exception> /// <exception cref="System.ArgumentException">Either <paramref name="projectName"/> or /// <paramref name="outputDirectory"/> is empty.</exception> /// <exception cref="System.IO.DirectoryNotFoundException"><paramref name="outputDirectory"/> /// cannot be found.</exception> /// <exception cref="ApplicationException"><c>ApplicationException</c> Directory Cannot Be Found.</exception> public CSharpProjectGenerator(IBuildSystem buildSystem, string projectName, string outputDirectory) { Guard.NotNull(() => buildSystem, buildSystem); this.buildSystem = buildSystem; // Null arguments will not be accepted if (projectName == null) { throw new ArgumentNullException( "projectName", Exceptions.ParameterCannotBeNull); } if (outputDirectory == null) { throw new ArgumentNullException( "outputDirectory", Exceptions.ParameterCannotBeNull); } // Empty arguments will not be accepted if (projectName.Length == 0) { throw new ArgumentException( Exceptions.StringCannotBeEmpty, "projectName"); } if (outputDirectory.Length == 0) { throw new ArgumentException( Exceptions.StringCannotBeEmpty, "outputDirectory"); } // Ensure that the output directory is valid if (!this.buildSystem.DirectoryExists(outputDirectory)) { throw new ApplicationException(Exceptions.DirectoryCannotBeFound); } // Set our member variables this.prjOutputDirectory = outputDirectory; this.projectName = projectName; // Set our collection member variables this.ClassFiles = new List <string>(); // We know that we'll need a reference to the NUnit framework, so // let's go ahead and add it this.referencedAssemblies = new List <AssemblyName> { new AssemblyName("NUnit.Framework") }; }
public TaskContextInternal( ILogger log, IBuildPropertiesSession taskContextProperties, CommandArguments args, TargetTree targetTree, IBuildSystem buildServers, ITaskFactory taskFactory, IFluentInterfaceFactory fluentFactory) : base(log, taskFactory, fluentFactory, targetTree, buildServers, taskContextProperties) { Args = args; }
public TaskSession( ILogger <TaskSession> log, TargetTree targetTree, CommandArguments args, ITaskFactory taskFactory, IFluentInterfaceFactory fluentFactory, IBuildPropertiesSession properties, IBuildSystem buildServers) : base(log, properties, args, targetTree, buildServers, taskFactory, fluentFactory) { HasFailed = true; }
/// <summary> /// Initializes a new instance of the <see cref="CSharpProjectGenerator"/> class /// within the given <paramref name="projectName"/> which will output to the given /// <paramref name="outputDirectory"/>. /// </summary> /// <param name="buildSystem">The build system.</param> /// <param name="projectName">The name of the project.</param> /// <param name="outputDirectory">The directory where the project /// will be output.</param> /// <exception cref="System.ArgumentNullException">Either <paramref name="projectName"/> or /// <paramref name="outputDirectory"/> is <c>null</c>.</exception> /// <exception cref="System.ArgumentException">Either <paramref name="projectName"/> or /// <paramref name="outputDirectory"/> is empty.</exception> /// <exception cref="System.IO.DirectoryNotFoundException"><paramref name="outputDirectory"/> /// cannot be found.</exception> /// <exception cref="ApplicationException"><c>ApplicationException</c> Directory Cannot Be Found.</exception> public CSharpProjectGenerator(IBuildSystem buildSystem, string projectName, string outputDirectory) { Guard.NotNull(() => buildSystem, buildSystem); this.buildSystem = buildSystem; // Null arguments will not be accepted if (projectName == null) { throw new ArgumentNullException( "projectName", Exceptions.ParameterCannotBeNull); } if (outputDirectory == null) { throw new ArgumentNullException( "outputDirectory", Exceptions.ParameterCannotBeNull); } // Empty arguments will not be accepted if (projectName.Length == 0) { throw new ArgumentException( Exceptions.StringCannotBeEmpty, "projectName"); } if (outputDirectory.Length == 0) { throw new ArgumentException( Exceptions.StringCannotBeEmpty, "outputDirectory"); } // Ensure that the output directory is valid if (!this.buildSystem.DirectoryExists(outputDirectory)) { throw new ApplicationException(Exceptions.DirectoryCannotBeFound); } // Set our member variables this.prjOutputDirectory = outputDirectory; this.projectName = projectName; // Set our collection member variables this.ClassFiles = new List<string>(); // We know that we'll need a reference to the NUnit framework, so // let's go ahead and add it this.referencedAssemblies = new List<AssemblyName> { new AssemblyName("NUnit.Framework") }; }
public void BuildSystemTest() { string projectFile = @"C:\Users\Test\file.wcodeproj"; string projectName = "Project"; IProject target = new Project(projectFile, projectName); IBuildSystem expected = new BuildSystem(target, true); IBuildSystem actual = target.BuildSystem; Assert.AreEqual(expected.BuildConfigs.Count, actual.BuildConfigs.Count); Assert.AreEqual(expected.MainFile, actual.MainFile); Assert.AreEqual(expected.Project.ProjectFile, actual.Project.ProjectFile); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpTestProjectBuilder"/> class. /// </summary> /// <param name="sbs">The system wide build system.</param> /// <param name="buildData">The build data properties.</param> /// <param name="projectGenerator">The project generator.</param> /// <param name="createGeneratorCallback">The callback to create new code /// generators per test class <see cref="CodeNamespace"/>.</param> /// <param name="logger">The logging method.</param> public CSharpTestProjectBuilder( IBuildSystem sbs, IBuildDataDictionary buildData, IProjectGenerator projectGenerator, Func <IBuildSystem, IBuildDataDictionary, ICodeGeneratorParameters, CodeNamespace, ICodeGenerator> createGeneratorCallback, Action <string> logger) : base(sbs, projectGenerator, OldOnCreateCodeGenerator, logger) { Guard.NotNull(() => buildData, buildData); Guard.NotNull(() => createGeneratorCallback, createGeneratorCallback); this.createGeneratorCallback = createGeneratorCallback; // properties = SetUpBuildProperties(); this.properties = SetUpBuildProperties(buildData); }
public TaskContext( ILogger log, ITaskFactory taskFactory, IFluentInterfaceFactory fluentFactory, TargetTree targetTree, IBuildSystem buildServers, IBuildPropertiesSession properties) : base(properties) { _log = log; _taskFactory = taskFactory; _fluentFactory = fluentFactory; _buildServers = buildServers; TargetTree = targetTree; }
/// <summary> /// Initializes a new instance of the <see cref="TestProjectBuilder"/> class. /// </summary> /// <param name="sbs">The system wide build system.</param> /// <param name="projectGenerator">The project generator.</param> /// <param name="createGeneratorCallback">The callback to create new code /// generators per test class <see cref="CodeNamespace"/>.</param> /// <param name="logger">The logging method.</param> public TestProjectBuilder( IBuildSystem sbs, IProjectGenerator projectGenerator, Func<IBuildSystem, ICodeGeneratorParameters, CodeNamespace, ICodeGenerator> createGeneratorCallback, Action<string> logger) { Guard.NotNull(() => sbs, sbs); Guard.NotNull(() => projectGenerator, projectGenerator); Guard.NotNull(() => createGeneratorCallback, createGeneratorCallback); // Guard.NotNull(() => logger, logger); this.sbs = sbs; this.logger = logger; this.csharpProjectGenerator = projectGenerator; this.createGeneratorCallback = createGeneratorCallback; }
/// <summary> /// Initializes a new instance of the <see cref="TestProjectBuilder"/> class. /// </summary> /// <param name="sbs">The system wide build system.</param> /// <param name="projectGenerator">The project generator.</param> /// <param name="createGeneratorCallback">The callback to create new code /// generators per test class <see cref="CodeNamespace"/>.</param> /// <param name="logger">The logging method.</param> public TestProjectBuilder( IBuildSystem sbs, IProjectGenerator projectGenerator, Func <IBuildSystem, ICodeGeneratorParameters, CodeNamespace, ICodeGenerator> createGeneratorCallback, Action <string> logger) { Guard.NotNull(() => sbs, sbs); Guard.NotNull(() => projectGenerator, projectGenerator); Guard.NotNull(() => createGeneratorCallback, createGeneratorCallback); // Guard.NotNull(() => logger, logger); this.sbs = sbs; this.logger = logger; this.csharpProjectGenerator = projectGenerator; this.createGeneratorCallback = createGeneratorCallback; }
/// <summary> /// Initializes a new instance of the <see cref="NStubCore"/> class which /// will generate the given <see cref="System.CodeDom.CodeNamespace"/> /// to the given output directory using the given implementation /// of <see cref="NStub.Core.ICodeGenerator"/>. /// </summary> /// <param name="buildSystem">The build system.</param> /// <param name="codeNamespace">The code namespace which contains the types /// to be generated.</param> /// <param name="outputDirectory">The directory where the resulting /// files will be output to.</param> /// <param name="codeGenerator">The code generator which will perform the /// generation.</param> /// <exception cref="System.ArgumentNullException">codeNamespace, /// outputDirectory, or codeGenerator is null.</exception> /// <exception cref="System.ArgumentException">outputDirectory is an /// empty string.</exception> /// <exception cref="System.IO.DirectoryNotFoundException">outputDirectory /// is not a valid directory.</exception> public NStubCore(IBuildSystem buildSystem, CodeNamespace codeNamespace, string outputDirectory, ICodeGenerator codeGenerator) { #region Validation Guard.NotNull(() => buildSystem, buildSystem); this.sbs = buildSystem; // Null arguments will not be accepted if (codeNamespace == null) { throw new ArgumentNullException("codeNamespace", Exceptions.ParameterCannotBeNull); } //Guard.NotNullOrEmpty(() => outputDirectory, outputDirectory); if (outputDirectory == null) { throw new ArgumentNullException("outputDirectory", Exceptions.ParameterCannotBeNull); } if (codeGenerator == null) { throw new ArgumentNullException("codeGenerator", Exceptions.ParameterCannotBeNull); } // The output directory can't be empty if (outputDirectory.Length == 0) { throw new ArgumentException(Exceptions.StringCannotBeEmpty, "outputDirectory"); } // Ensure the output directory is valid if (!(buildSystem.DirectoryExists(outputDirectory))) { throw new System.IO.DirectoryNotFoundException(Exceptions.DirectoryCannotBeFound); } #endregion Validation // Set our member variables _codeNamespace = codeNamespace; _outputDirectory = outputDirectory; InitCodeGenerator(codeGenerator); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpCodeGenerator"/> class /// based the given <see cref="CodeNamespace"/> which will output to the given directory. /// </summary> /// <param name="buildSystem">The build system.</param> /// <param name="codeNamespace">The code namespace.</param> /// <param name="testBuilders">The test builders.</param> /// <param name="configuration">The configuration.</param> /// <exception cref="System.ArgumentNullException"><paramref name="codeNamespace"/> or /// outputDirectory is <see langword="null"/>.</exception> /// <exception cref="System.ArgumentException">outputDirectory is an /// empty string.</exception> /// <exception cref="System.IO.DirectoryNotFoundException">outputDirectory /// cannot be found.</exception> /// <exception cref="ApplicationException"><c>ApplicationException</c> Directory Cannot Be Found.</exception> public CSharpCodeGenerator( IBuildSystem buildSystem, CodeNamespace codeNamespace, IMemberBuilderFactory testBuilders, ICodeGeneratorParameters configuration) { Guard.NotNull(() => buildSystem, buildSystem); this.buildSystem = buildSystem; Guard.NotNull(() => configuration, configuration); // this.configuration = configuration; string outputDirectory = configuration.OutputDirectory; // Null arguments will not be accepted if (codeNamespace == null) { throw new ArgumentNullException( "codeNamespace", Exceptions.ParameterCannotBeNull); } if (outputDirectory == null) { throw new ArgumentNullException( "outputDirectory", Exceptions.ParameterCannotBeNull); } // Ensure that the output directory is not empty if (outputDirectory.Length == 0) { throw new ArgumentException( Exceptions.StringCannotBeEmpty, "outputDirectory"); } // Ensure that the output directory is valid if (!this.buildSystem.DirectoryExists(outputDirectory)) { throw new ApplicationException(Exceptions.DirectoryCannotBeFound); } this.codeNamespace = codeNamespace; this.OutputDirectory = outputDirectory; }
/// <summary> /// Called when the <c>TestProjectBuilder</c> is about to create the code generator. /// </summary> /// <param name="codeNamespace">The code namespace.</param> /// <param name="configuration">The configuration.</param> /// <param name="buildSystem">The build system.</param> /// <returns>An with the parameters initialized code generator.</returns> /// <remarks>Override this method to instantiate others than the standard generators. /// <example>The default implementation is: /// <code><![CDATA[ /// protected virtual ICodeGenerator OnCreateCodeGenerator(CodeNamespace codeNamespace, CodeGeneratorParameters configuration, IBuildSystem buildSystem) /// { /// var codeGenerator = this.createGeneratorCallback(buildSystem, configuration, codeNamespace); /// return codeGenerator; /// } /// ]]></code></example> /// </remarks> protected virtual ICodeGenerator OnCreateCodeGenerator( CodeNamespace codeNamespace, ICodeGeneratorParameters configuration, IBuildSystem buildSystem) { var codeGenerator = this.createGeneratorCallback(buildSystem, configuration, codeNamespace); return codeGenerator; }
private static ICodeGenerator OldOnCreateCodeGenerator( IBuildSystem buildSystem, ICodeGeneratorParameters configuration, CodeNamespace codeNamespace) { return(null); }
public void SetUp() { this.testObject = new StandardBuildSystem(); this.fakeObject = new FakeBuildSystem(); }