public void Given_Select_1_With_Result_0_Should_Be_Valid_With_AreNotEqual_AssertType()
        {
            var test = new Test
            {
                Name            = "someTest",
                TestValue       = "Select 1",
                ExpectedResults =
                    new ExpectedResultList
                {
                    new ExpectedResult(1, 1, 1, 1, "0", 0)
                    {
                        AssertType = new AssertType(2, "AreNotEqual")
                    }
                },
                TestType = new TestType(1, "sqlsnippet", "", true)
            };
            var sqlVal = new SqlScriptValidator();

            var valResult =
                sqlVal.Validate(
                    _connection, test);

            Assert.IsTrue(valResult.IsValid);
            Console.WriteLine(valResult.ResultMessage);
        }
Esempio n. 2
0
        public ValidationResponse Validate()
        {
            var scriptVal = new SqlScriptValidator();

            Response = scriptVal.Validate(Connection, Test);
            return(Response);
        }
        private static Collection <ValidationResponse> ExecuteTests(IEnumerable <Test> tests, Connection connection)
        {
            var scriptVal   = new SqlScriptValidator();
            var valResponse = new Collection <ValidationResponse>();

            foreach (var test in tests)
            {
                var valResult = scriptVal.Validate(connection, test);
                if (valResult == null)
                {
                    continue;
                }
                valResponse.Add(valResult);
            }

            return(valResponse);
        }
 public void Given_Select_1_With_Result_0_Should_Not_Be_Valid()
 {
     var test = new Test
     {
         Name = "someTest",
         TestValue = "Select 1",
         ExpectedResults =
             new ExpectedResultList
             {
                 new ExpectedResult(1, 1, 1, 1, "0", 0) {AssertType = new AssertType(1, "AreEqual")}
             },
         TestType = new TestType(1, "sqlsnippet", "", true)
     };
     var sqlVal = new SqlScriptValidator();
     var valResult =
         sqlVal.Validate(
             _connection, test);
     Assert.IsFalse(valResult.IsValid);
     Console.WriteLine(valResult.ResultMessage);
 }
Esempio n. 5
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            var repo       = new WebApiRepositoryContext("http://*****:*****@"Data Source=(localdb)\V11.0;Initial Catalog=Chinook;Integrated Security=True;", true, true);

            if (connection.ConnectionProviderId != null)
            {
                connection.ConnectionProvider =
                    repo.ConnectionProviderRepository.GetDataById(connection.ConnectionProviderId).FirstOrDefault();
            }
            var valResult =
                scriptVal.Validate(connection
                                   , _test);


            repo.RunHistoryRepository.Insert(_test.Id, null, null, connection.ConnectionId, valResult.RunDateTime, valResult.Duration, valResult.IsValid, valResult.RunLog);
            MessageBox.Show(valResult.IsValid.ToString());
        }
        public void Given_Invalid_TestValue_With_Result_0_Should_Not_Be_Valid()
        {
            var test = new Test
            {
                Name            = "someTest",
                TestValue       = "Gibberish",
                ExpectedResults =
                    new ExpectedResultList
                {
                    new ExpectedResult(1, 1, 1, 1, "0", 0)
                    {
                        AssertType = new AssertType(1, "AreEqual")
                    }
                },
                TestType = new TestType(1, "sqlsnippet", "", true)
            };
            var sqlVal    = new SqlScriptValidator();
            var valResult =
                sqlVal.Validate(
                    _connection, test);

            Assert.IsFalse(valResult.IsValid);
            Console.WriteLine(valResult.ResultMessage);
        }