示例#1
0
        public void DeriveCodeGenLanguage()
        {
            Assert.Equal(CodeGenLanguage.CSharp, GeneratorConfigurationUtils.DeriveCodeGenLanguage("test.csproj"));
            Assert.Equal(CodeGenLanguage.FSharp, GeneratorConfigurationUtils.DeriveCodeGenLanguage("test.fsproj"));
            Assert.Equal(CodeGenLanguage.Vb, GeneratorConfigurationUtils.DeriveCodeGenLanguage("test.vbproj"));
            var exception = Assert.Throws <ArgumentException>(() => GeneratorConfigurationUtils.DeriveCodeGenLanguage("test.sln"));

            Assert.Equal("Could not derive code gen language. Unrecognised project file type (.sln).", exception.Message);
        }
示例#2
0
        public void FindFirstProjectFile_WillReturnsTheFirstOfManyMatchingProjectFiles()
        {
            var csProjFile = TestEnvironment.WriteFileToFolder(_projectPath, "test1.csproj", string.Empty);
            var fsProjFile = TestEnvironment.WriteFileToFolder(_projectPath, "test1.fsproj", string.Empty);
            var vbProjFile = TestEnvironment.WriteFileToFolder(_projectPath, "test1.vbproj", string.Empty);

            try
            {
                Assert.NotNull(GeneratorConfigurationUtils.FindFirstProjectFile(_projectPath));
                //we're not presently concerned which file was returned
            }
            finally
            {
                File.Delete(csProjFile);
                File.Delete(fsProjFile);
                File.Delete(vbProjFile);
            }
        }
示例#3
0
        public void FindFirstProjectFile_FindExpectedFilesOrReturnsNull(string projectFileName, bool expectItToBeFound)
        {
            var expectedProjectFilePath = TestEnvironment.WriteFileToFolder(_projectPath, projectFileName, string.Empty);

            try
            {
                var firstFile = GeneratorConfigurationUtils.FindFirstProjectFile(_projectPath);
                if (expectItToBeFound)
                {
                    Assert.Equal(expectedProjectFilePath, firstFile);
                }
                else
                {
                    Assert.Null(firstFile);
                }
            }
            finally
            {
                File.Delete(expectedProjectFilePath);
            }
        }
示例#4
0
 public void CreateNamespaceFromAssemblyName()
 {
     Assert.Equal("Company.Project", GeneratorConfigurationUtils.CreateNamespaceFromAssemblyName("Company.Project.dll"));
 }
示例#5
0
        public void DeriveConfigFilePath()
        {
            var expectedPath = Path.Combine(_projectPath, "Nethereum.Generator.json");

            Assert.Equal(expectedPath, GeneratorConfigurationUtils.DeriveConfigFilePath(_projectPath));
        }
示例#6
0
 public void GetFullFileAndFolderPaths_GivenFolderPath_ReturnsOnlyFolderPath()
 {
     (string folder, string file) = GeneratorConfigurationUtils.GetFullFileAndFolderPaths(_projectPath);
     Assert.Equal(_projectPath, folder);
     Assert.Null(file);
 }
示例#7
0
 public void GetFullFileAndFolderPaths_GivenFileFullPath_ReturnsBothFullPaths()
 {
     (string folder, string file) = GeneratorConfigurationUtils.GetFullFileAndFolderPaths(_abiFileAbsolutePath);
     Assert.Equal(_projectPath, folder);
     Assert.Equal(_abiFileAbsolutePath, file);
 }