Пример #1
0
        public void ShouldGenerateFunctionOutputDTOFullClass()
        {
            var service = new FunctionCQSMessageGenerator();
            var output  = service.GenerateFullClass(abi, namespaceName, functionOutputNamespaceName);

            Assert.Equal(expectedClassFullOutput, output);
        }
Пример #2
0
        public void ShouldGenerateFunctionOutputDTOClass()
        {
            var service = new FunctionCQSMessageGenerator();
            var output  = service.GenerateClass(abi);

            Assert.Equal(expectedClassOutput, output);
        }
        public List <GeneratedFile> GeneratCQSFunctionMessages()
        {
            var cqsFullNamespace = GetFullNamespace(CQSNamespace);
            var cqsFullPath      = GetFullPath(CQSNamespace);
            var dtoFullNamespace = GetFullNamespace(DTONamespace);
            var generated        = new List <GeneratedFile>();

            foreach (var functionAbi in ContractABI.Functions)
            {
                var cqsGenerator = new FunctionCQSMessageGenerator(functionAbi, cqsFullNamespace, dtoFullNamespace, CodeGenLanguage);
                GenerateAndAdd(generated, () => cqsGenerator.GenerateFileContent(cqsFullPath));
            }
            return(generated);
        }
        public void GeneratesExpectedFileContent()
        {
            var expectedContent = ExpectedContentRepository.Get("CSharp", "FunctionCQSMessage01.csharp.txt");

            var functionAbi = new FunctionABI("BaseStats", constant: true)
            {
                InputParameters  = new[] { new ParameterABI("uint256", "_number") },
                OutputParameters = new[] { new ParameterABI("uint256") }
            };

            var generator   = new FunctionCQSMessageGenerator(functionAbi, "DefaultNamespace", "FunctionOutput");
            var fileContent = generator.GenerateFileContent();

            Assert.Equal(expectedContent, fileContent);
        }
Пример #5
0
        public List <FunctionCQSMessageGenerator> GetAllCQSFunctionMessageGenerators()
        {
            var cqsFullNamespace = GetFullNamespace(CQSNamespace);

            var dtoFullNamespace = GetFullNamespace(DTONamespace);

            dtoFullNamespace = FullyQualifyNamespaceFromImport(dtoFullNamespace);

            var generators = new List <FunctionCQSMessageGenerator>();

            foreach (var functionAbi in ContractABI.Functions)
            {
                var cqsGenerator = new FunctionCQSMessageGenerator(functionAbi, cqsFullNamespace, dtoFullNamespace, CodeGenLanguage);
                generators.Add(cqsGenerator);
            }
            return(generators);
        }