public void ResolveEmptyValuesWithDefaults_EmptyContractNameIsDefaultedToNameOfAbiFile() { //given var abiConfiguration = new ABIConfiguration { ABIFile = _abiFileAbsolutePath, ContractName = null }; //when abiConfiguration.ResolveEmptyValuesWithDefaults("Sample.Contract", _projectPath); //then Assert.Equal("StandardContract", abiConfiguration.ContractName); }
public void ResolveEmptyValuesWithDefaults_WhenBinFileIsEmptyItWillBeFoundWhenInTheSameFolderAsAbi() { //given var abiConfiguration = new ABIConfiguration { ABIFile = _abiFileAbsolutePath, BinFile = null, ByteCode = null }; //when abiConfiguration.ResolveEmptyValuesWithDefaults("Sample.Contract", _projectPath); //then Assert.Equal(TestContracts.StandardContract.ByteCode, abiConfiguration.ByteCode); }
public void ResolveEmptyValuesWithDefaults_BinFileCanBeARelativePath() { //given var abiConfiguration = new ABIConfiguration { ABIFile = _abiFileAbsolutePath, BinFile = "StandardContract.bin" }; //when abiConfiguration.ResolveEmptyValuesWithDefaults("Sample.Contract", _projectPath); //then Assert.Equal(TestContracts.StandardContract.ByteCode, abiConfiguration.ByteCode); }
public void ResolveEmptyValuesWithDefaults_WhenAbiContentIsEmptyItIsReadFromAbiFile() { //given var abiConfiguration = new ABIConfiguration { ABI = null, ABIFile = _abiFileAbsolutePath }; //when abiConfiguration.ResolveEmptyValuesWithDefaults("Sample.Contract", _projectPath); //then Assert.Equal(TestContracts.StandardContract.ABI, abiConfiguration.ABI); }
public void ResolveEmptyValuesWithDefaults_AbiFileCanBeRelativePath() { //given var abiConfiguration = new ABIConfiguration { ABI = null, ABIFile = Path.GetRelativePath(_projectPath, _abiFileAbsolutePath) }; //when abiConfiguration.ResolveEmptyValuesWithDefaults("Sample.Contract", _projectPath); //then Assert.Equal(TestContracts.StandardContract.ABI, abiConfiguration.ABI); }
public void ResolveEmptyValuesWithDefaults_AbiFileCanBeInParentFolderOfTheProjectRoot() { //given var solidityFolder = CreateSolidityFolderInParentOfProjectRoot(); var abiInSolidityFolder = Path.Combine(solidityFolder, Path.GetFileName(_abiFileAbsolutePath)); File.Copy(_abiFileAbsolutePath, abiInSolidityFolder, true); var abiConfiguration = new ABIConfiguration { ABI = null, ABIFile = "..\\solidity\\StandardContract.abi" }; //when abiConfiguration.ResolveEmptyValuesWithDefaults("Sample.Contract", _projectPath); //then Assert.Equal(TestContracts.StandardContract.ABI, abiConfiguration.ABI); }