public void ShouldVerifySameTableTurkish()
        {
            //NH-3063

            // Turkish have unusual casing rules for the letter 'i'. This test verifies that
            // code paths executed by the SchemaValidator correctly handles case insensitive
            // comparisons for this.

            // Just make sure that we have an int property in the mapped class. This is
            // the 'i' we rely on for the test.
            var v = new Version();

            Assert.That(v.Id, Is.TypeOf <int>());

            var cfg = BuildConfiguration(_version1Resource);

            var export = new SchemaExport(cfg);

            export.Create(true, true);
            try
            {
                var validator = new Tool.hbm2ddl.SchemaValidator(cfg);
                validator.Validate();
            }
            finally
            {
                export.Drop(true, true);
            }
        }
		public void ShouldVerifySameTable()
		{
			const string resource = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
			var cfg = BuildConfiguration(resource);

			new SchemaExport(cfg).Execute(true, true, false);

			var validator = new Tool.hbm2ddl.SchemaValidator((cfg));
			validator.Validate();
		}
        public void ShouldNotVerifyModifiedTable()
        {
            var cfgV2       = BuildConfiguration(_version2Resource);
            var validatorV2 = new Tool.hbm2ddl.SchemaValidator(cfgV2);

            Assert.That(
                () => validatorV2.Validate(),
                Throws.TypeOf <SchemaValidationException>()
                .And.Message.EqualTo("Schema validation failed: see list of validation errors")
                .And.Property("ValidationErrors").Some.Contains("Missing column: Name in ").IgnoreCase.And.Contains("Version").IgnoreCase);
        }
Ejemplo n.º 4
0
        public void ShouldVerifySameTable()
        {
            const string resource = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
            var          cfg      = BuildConfiguration(resource);

            new SchemaExport(cfg).Execute(true, true, false);

            var validator = new Tool.hbm2ddl.SchemaValidator((cfg));

            validator.Validate();
        }
Ejemplo n.º 5
0
 public Task ShouldVerifySameTableAsync()
 {
     try
     {
         var validator = new Tool.hbm2ddl.SchemaValidator((_configuration1));
         return(validator.ValidateAsync());
     }
     catch (System.Exception ex)
     {
         return(Task.FromException <object>(ex));
     }
 }
        public async Task ShouldVerifyAsync()
        {
            var validator = new Tool.hbm2ddl.SchemaValidator(cfg);

            try
            {
                await(validator.ValidateAsync());
            }
            catch (SchemaValidationException sve)
            {
                Assert.Fail("Validation failed: {0}.\n{1}", StringHelper.CollectionToString(sve.ValidationErrors), sve);
            }
        }
        public void ShouldNotVerifyMultiModifiedTable()
        {
            var cfg = BuildConfiguration(_version3Resource);

            var validator = new Tool.hbm2ddl.SchemaValidator(cfg);

            var error = Assert.Throws <SchemaValidationException>(() => validator.Validate());

            Assert.That(error,
                        Has.Message.EqualTo("Schema validation failed: see list of validation errors")
                        .And.Property("ValidationErrors").Some.Contains("Missing column: Name in ").IgnoreCase.And.Contains("Version").IgnoreCase);
            Assert.That(error,
                        Has.Property("ValidationErrors").Some.Contains("Missing column: Title in ").IgnoreCase.And.Contains("Version").IgnoreCase);
            Assert.That(error,
                        Has.Property("ValidationErrors").Some.Contains("Missing sequence or table: ").IgnoreCase.And.Contains("id_table").IgnoreCase);
        }
		public void ShouldNotVerifyModifiedTable()
		{
			const string resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
			var cfgV1 = BuildConfiguration(resource1);

			const string resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.2_Version.hbm.xml";
			var cfgV2 = BuildConfiguration(resource2);

			new SchemaExport(cfgV1).Execute(true, true, false);

			var validatorV2 = new Tool.hbm2ddl.SchemaValidator(cfgV2);
			try
			{
				validatorV2.Validate();
			}
			catch (HibernateException e)
			{
				Assert.That(e.Message, Is.StringStarting("Missing column: Name"));
			}
		}
Ejemplo n.º 9
0
        public void ShouldNotVerifyModifiedTable()
        {
            const string resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
            var          cfgV1     = BuildConfiguration(resource1);

            const string resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.2_Version.hbm.xml";
            var          cfgV2     = BuildConfiguration(resource2);

            new SchemaExport(cfgV1).Execute(true, true, false);

            var validatorV2 = new Tool.hbm2ddl.SchemaValidator(cfgV2);

            try
            {
                validatorV2.Validate();
            }
            catch (HibernateException e)
            {
                Assert.That(e.Message, Is.StringStarting("Missing column: Name"));
            }
        }
		public void ShouldVerifySameTableTurkish()
		{
			//NH-3063

			// Turkish have unusual casing rules for the letter 'i'. This test verifies that
			// code paths executed by the SchemaValidator correctly handles case insensitive
			// comparisons for this.

			// Just make sure that we have an int property in the mapped class. This is
			// the 'i' we rely on for the test.
			var v = new Version();
			Assert.That(v.Id, Is.TypeOf<int>());


			const string resource = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
			var cfg = BuildConfiguration(resource);

			new SchemaExport(cfg).Execute(true, true, false);

			var validator = new Tool.hbm2ddl.SchemaValidator(cfg);
			validator.Validate();
		}
Ejemplo n.º 11
0
        public void ShouldVerifySameTableTurkish()
        {
            //NH-3063

            // Turkish have unusual casing rules for the letter 'i'. This test verifies that
            // code paths executed by the SchemaValidator correctly handles case insensitive
            // comparisons for this.

            // Just make sure that we have an int property in the mapped class. This is
            // the 'i' we rely on for the test.
            var v = new Version();

            Assert.That(v.Id, Is.TypeOf <int>());


            const string resource = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
            var          cfg      = BuildConfiguration(resource);

            new SchemaExport(cfg).Execute(true, true, false);

            var validator = new Tool.hbm2ddl.SchemaValidator(cfg);

            validator.Validate();
        }
        public void ShouldVerifySameTable()
        {
            var validator = new Tool.hbm2ddl.SchemaValidator((_configuration1));

            validator.Validate();
        }
        public async Task ShouldVerifySameTableAsync()
        {
            var validator = new Tool.hbm2ddl.SchemaValidator((_configuration1));

            return(validator.ValidateAsync());
        }