NStub.CSharp.CSharpProjectGenerator.CSharpProjectGenerator C# (CSharp) Method

CSharpProjectGenerator() public method

Initializes a new instance of the CSharpProjectGenerator class within the given projectName which will output to the given outputDirectory.
Either or /// is null. Either or /// is empty. /// cannot be found. ApplicationException Directory Cannot Be Found.
public CSharpProjectGenerator ( IBuildSystem buildSystem, string projectName, string outputDirectory ) : System
buildSystem IBuildSystem The build system.
projectName string The name of the project.
outputDirectory string The directory where the project /// will be output.
return System
        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") };
        }