コード例 #1
0
        public TestJsonAttribute(
            string projectName,
            string className,
            string methodName,
            string testScenario,
            string testCase,
            DatabaseProvider databaseProvider,
            string connectionString
            )
        {
            _config = new TestJsonConfig {
                DatabaseName     = "(from connection string)",
                ServerName       = "(from connection string)",
                ConnectionString = connectionString,
                TestJsonSchema   = "",
                TestJsonTable    = "TestJson",
                ProjectName      = projectName,
                ClassName        = className,
                MethodName       = methodName,
                TestScenario     = testScenario,
                TestCase         = testCase
            };


            _configKey = new TestJsonConfig {
                ConnectionString = _config.ConnectionString,
                TestJsonSchema   = _config.TestJsonSchema,
                TestJsonTable    = _config.TestJsonTable,
                ProjectName      = _config.ProjectName
            }.ToString();


            if (!TestCases.ContainsKey(_configKey))
            {
                if (databaseProvider == DatabaseProvider.Excel)
                {
                    TestCases.Add(_configKey, JsonTestCase.GetTestCasesForProjectExcel(
                                      _config.ConnectionString, projectName));
                }
                else
                {
                    TestCases.Add(_configKey, JsonTestCase.GetTestCasesForProject(
                                      databaseProvider, connectionString, projectName));
                }
            }
        }
コード例 #2
0
        public TestJsonAttribute(
            string databaseName,
            string projectName,
            string className,
            string methodName,
            string testScenario,
            string testCase,
            string serverName     = "(LocalDb)\\MSSQLLocalDb",
            string testJsonSchema = "_",
            string testJsonTable  = "TestJson"
            )
        {
            _config = new TestJsonConfig {
                DatabaseName     = databaseName,
                ServerName       = serverName,
                ConnectionString = $"Server={serverName};Database={databaseName};Trusted_Connection=True;MultipleActiveResultSets=true",
                TestJsonSchema   = testJsonSchema,
                TestJsonTable    = testJsonTable,
                ProjectName      = projectName,
                ClassName        = className,
                MethodName       = methodName,
                TestScenario     = testScenario,
                TestCase         = testCase
            };


            _configKey = new TestJsonConfig {
                ConnectionString = _config.ConnectionString,
                TestJsonSchema   = _config.TestJsonSchema,
                TestJsonTable    = _config.TestJsonTable,
                ProjectName      = _config.ProjectName
            }.ToString();


            if (!TestCases.ContainsKey(_configKey))
            {
                TestCases.Add(_configKey, JsonTestCase.GetTestCasesForProject(
                                  _config.ConnectionString,
                                  _config.TestJsonSchema,
                                  _config.TestJsonTable,
                                  _config.ProjectName));
            }
        }