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); }
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); } }
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); } }
public void CreateNamespaceFromAssemblyName() { Assert.Equal("Company.Project", GeneratorConfigurationUtils.CreateNamespaceFromAssemblyName("Company.Project.dll")); }
public void DeriveConfigFilePath() { var expectedPath = Path.Combine(_projectPath, "Nethereum.Generator.json"); Assert.Equal(expectedPath, GeneratorConfigurationUtils.DeriveConfigFilePath(_projectPath)); }
public void GetFullFileAndFolderPaths_GivenFolderPath_ReturnsOnlyFolderPath() { (string folder, string file) = GeneratorConfigurationUtils.GetFullFileAndFolderPaths(_projectPath); Assert.Equal(_projectPath, folder); Assert.Null(file); }
public void GetFullFileAndFolderPaths_GivenFileFullPath_ReturnsBothFullPaths() { (string folder, string file) = GeneratorConfigurationUtils.GetFullFileAndFolderPaths(_abiFileAbsolutePath); Assert.Equal(_projectPath, folder); Assert.Equal(_abiFileAbsolutePath, file); }