public void TestGetStoredProcCodeGenerationMetaData() { //ASSEMBLE database.Refresh(); var storedProcList = CodeGeneratorHelper.GetStoredProcedureList(database, codeGenerationSchemaName); var schemaName = storedProcList[0].SchemaName; var storeProcName = storedProcList[0].StoredProcName; //ACT var codeGenerationTargetMetaData = new CodeGenerationTargetMetaData { ProjectRootPath = projectRootPath, ProjectName = projectName, ConnectionString = connectionString, DatabaseName = databaseName, SchemaName = schemaName, StoredProcName = storeProcName, NameSpace = nameSpace }; var storedProcResultSetMetaData = CodeGeneratorHelper.ProcessStoredProcedure(codeGenerationTargetMetaData); var methodName = storedProcResultSetMetaData.MethodName; //ASSERT Assert.IsTrue(storedProcResultSetMetaData.IsStoredProcValid); Assert.IsNotNull(codeGenerationTargetMetaData); Assert.IsNotNull(storedProcResultSetMetaData); }
public void TestGetStoredProcCodeGenerationMetaDataByStoredProcName() { //ASSEMBLE database.Refresh(); const string schemaName = "API"; const string storeProcName = "GameByGameId"; const string assemblyPath = @"C:\ProjectStoreGit\Solutia-MobilePatronsApp\Application\Server\MobilePatronsApp.Service\MobilePatronsApp.DataContracts\bin\Debug\MobilePatronsApp.DataContracts.dll"; //var assemblyPath = @"C:\ProjectStoreGit\Solutia-CandidateTracking\Application\Server\CandidateTracking.DataContracts\bin\Debug\CandidateTracking.DataContracts.dll"; byte[] data; using (var fs = System.IO.File.OpenRead(assemblyPath)) { data = new byte[fs.Length]; fs.Read(data, 0, Convert.ToInt32(fs.Length)); } if (data == null || data.Length == 0) { throw new ApplicationException("Failed to load " + assemblyPath); } var interfaceAssembly = System.Reflection.Assembly.Load(data); //ACT var codeGenerationTargetMetaData = new CodeGenerationTargetMetaData { InterfaceAssembly = interfaceAssembly, ProjectRootPath = projectRootPath, ProjectName = projectName, ConnectionString = connectionString, DatabaseName = databaseName, SchemaName = schemaName, StoredProcName = storeProcName, NameSpace = nameSpace }; var storedProcResultSetMetaData = CodeGeneratorHelper.ProcessStoredProcedure(codeGenerationTargetMetaData); var methodName = storedProcResultSetMetaData.MethodName; //ASSERT Assert.IsTrue(storedProcResultSetMetaData.IsStoredProcValid); Assert.IsNotNull(codeGenerationTargetMetaData); Assert.IsNotNull(storedProcResultSetMetaData); }