Example #1
0
        public void Test_IsStringValid()
        {
            List <string> myList;

            for (var i = 1; i < 128; i++)
            {
                myList = RandomFactory.GetRandomListOfString(64, i);
                foreach (var s in myList)
                {
                    var res = Utils.IsStringValid(s);
                    Assert.AreEqual(res, true);
                }
            }

            for (var i = 1; i < 128; i++)
            {
                myList = RandomFactory.GetRandomListOfInt(64, i);
                foreach (var s in myList)
                {
                    var res = Utils.IsStringValid(s);
                    Assert.AreEqual(res, true);
                }
            }

            for (var i = 1; i < 128; i++)
            {
                myList = RandomFactory.GetRandomListOfSpecialString(64, i);
                foreach (var s in myList)
                {
                    var res = Utils.IsStringValid(s);
                    Assert.AreEqual(res, false);
                }
            }
        }
Example #2
0
        public void SqlServer_common()
        {
            SqlConnection conn = _s.GetConnection();

            Assert.IsNotNull(conn);
            Assert.IsNull(_s.Instancename);
            Assert.AreEqual(_s.IsBusy, false);
            Assert.IsNull(_s.IsOnline);

            var connection = _s.TestConnectionSync();

            Assert.AreEqual(connection, true);

            _s.GetDbList(true);
            _s.GetDbList(false);

            var wrongName      = RandomFactory.GetRandomListOfSpecialString(1, 64)[0];
            var wrongdbcreated = _s.CreateDatabaseSync(wrongName);

            Assert.AreEqual(wrongdbcreated, false);
            wrongdbcreated = _s.CreateDatabaseSync(wrongName);
            Assert.AreEqual(wrongdbcreated, false);

            var goodNames = RandomFactory.GetRandomListOfString(8, 32);

            foreach (var goodName in goodNames)
            {
                var dbcreated = _s.CreateDatabaseSync(goodName);
                Assert.AreEqual(dbcreated, true);
                var deleted = _s.Drop(goodName).Result;
                Assert.AreEqual(deleted, true);
            }

            _s.GetPaths();
            _s.GetPhysicalFiles();

            Utils.SerializeBinary(new List <SqlInstance>()
            {
                _s
            });
            _s = null;

            _s = Utils.DeserializeBinary()[0];
            Assert.AreNotEqual(_s, null);
        }