コード例 #1
0
        [Test] // QuoteIdentifier (String)
        public void QuoteIdentifier()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            try
            {
                cb.QuoteIdentifier((string)null);
                Assert.Fail("#A1");
            }
            catch (NotSupportedException ex)
            {
                Assert.AreEqual(typeof(NotSupportedException), ex.GetType(), "#A2");
                Assert.IsNull(ex.InnerException, "#A3");
                Assert.AreEqual((new NotSupportedException()).Message, ex.Message, "#A4");
            }

            try
            {
                cb.QuoteIdentifier("mono");
                Assert.Fail("#B1");
            }
            catch (NotSupportedException ex)
            {
                Assert.AreEqual(typeof(NotSupportedException), ex.GetType(), "#B2");
                Assert.IsNull(ex.InnerException, "#B3");
                Assert.AreEqual((new NotSupportedException()).Message, ex.Message, "#B4");
            }
        }
コード例 #2
0
ファイル: DbCommandBuilderTest.cs プロジェクト: dotnet/corefx
 public void ConflictOptionTest()
 {
     MyCommandBuilder cb = new MyCommandBuilder();
     Assert.Equal(ConflictOption.CompareAllSearchableValues, cb.ConflictOption);
     cb.ConflictOption = ConflictOption.CompareRowVersion;
     Assert.Equal(ConflictOption.CompareRowVersion, cb.ConflictOption);
 }
コード例 #3
0
        [Fact] // QuoteIdentifier (String)
        public void QuoteIdentifier()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            try
            {
                cb.QuoteIdentifier(null);
                Assert.False(true);
            }
            catch (NotSupportedException ex)
            {
                Assert.Equal(typeof(NotSupportedException), ex.GetType());
                Assert.Null(ex.InnerException);
                Assert.Equal((new NotSupportedException()).Message, ex.Message);
            }

            try
            {
                cb.QuoteIdentifier("mono");
                Assert.False(true);
            }
            catch (NotSupportedException ex)
            {
                Assert.Equal(typeof(NotSupportedException), ex.GetType());
                Assert.Null(ex.InnerException);
                Assert.Equal((new NotSupportedException()).Message, ex.Message);
            }
        }
コード例 #4
0
		public void CatalogLocationTest ()
		{
			MyCommandBuilder cb = new MyCommandBuilder ();
			Assert.AreEqual (CatalogLocation.Start, cb.CatalogLocation, "#1");
			cb.CatalogLocation = CatalogLocation.End;
			Assert.AreEqual (CatalogLocation.End, cb.CatalogLocation, "#2");
		}
コード例 #5
0
        public void ConflictOptionTest()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            Assert.AreEqual(ConflictOption.CompareAllSearchableValues, cb.ConflictOption, "#1");
            cb.ConflictOption = ConflictOption.CompareRowVersion;
            Assert.AreEqual(ConflictOption.CompareRowVersion, cb.ConflictOption, "#2");
        }
コード例 #6
0
        public void CatalogLocationTest()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            Assert.AreEqual(CatalogLocation.Start, cb.CatalogLocation, "#1");
            cb.CatalogLocation = CatalogLocation.End;
            Assert.AreEqual(CatalogLocation.End, cb.CatalogLocation, "#2");
        }
コード例 #7
0
        [Fact] // QuoteIdentifier (String)
        public void QuoteIdentifier()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            NotSupportedException ex = Assert.Throws <NotSupportedException>(() => cb.QuoteIdentifier(null));

            Assert.Null(ex.InnerException);
            Assert.Equal((new NotSupportedException()).Message, ex.Message);

            NotSupportedException ex2 = Assert.Throws <NotSupportedException>(() => cb.QuoteIdentifier("mono"));

            Assert.Null(ex.InnerException);
            Assert.Equal((new NotSupportedException()).Message, ex.Message);
        }
コード例 #8
0
		public void CatalogSeparator ()
		{
			MyCommandBuilder cb = new MyCommandBuilder ();
			Assert.AreEqual (".", cb.CatalogSeparator, "#1");
			cb.CatalogSeparator = "a";
			Assert.AreEqual ("a", cb.CatalogSeparator, "#2");
			cb.CatalogSeparator = null;
			Assert.AreEqual (".", cb.CatalogSeparator, "#3");
			cb.CatalogSeparator = "b";
			Assert.AreEqual ("b", cb.CatalogSeparator, "#4");
			cb.CatalogSeparator = string.Empty;
			Assert.AreEqual (".", cb.CatalogSeparator, "#5");
			cb.CatalogSeparator = " ";
			Assert.AreEqual (" ", cb.CatalogSeparator, "#6");
		}
コード例 #9
0
ファイル: DbCommandBuilderTest.cs プロジェクト: dotnet/corefx
 public void CatalogSeparator()
 {
     MyCommandBuilder cb = new MyCommandBuilder();
     Assert.Equal(".", cb.CatalogSeparator);
     cb.CatalogSeparator = "a";
     Assert.Equal("a", cb.CatalogSeparator);
     cb.CatalogSeparator = null;
     Assert.Equal(".", cb.CatalogSeparator);
     cb.CatalogSeparator = "b";
     Assert.Equal("b", cb.CatalogSeparator);
     cb.CatalogSeparator = string.Empty;
     Assert.Equal(".", cb.CatalogSeparator);
     cb.CatalogSeparator = " ";
     Assert.Equal(" ", cb.CatalogSeparator);
 }
コード例 #10
0
        public void CatalogSeparator()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            Assert.AreEqual(".", cb.CatalogSeparator, "#1");
            cb.CatalogSeparator = "a";
            Assert.AreEqual("a", cb.CatalogSeparator, "#2");
            cb.CatalogSeparator = null;
            Assert.AreEqual(".", cb.CatalogSeparator, "#3");
            cb.CatalogSeparator = "b";
            Assert.AreEqual("b", cb.CatalogSeparator, "#4");
            cb.CatalogSeparator = string.Empty;
            Assert.AreEqual(".", cb.CatalogSeparator, "#5");
            cb.CatalogSeparator = " ";
            Assert.AreEqual(" ", cb.CatalogSeparator, "#6");
        }
コード例 #11
0
        public void ConflictOption_Value_Invalid()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            cb.ConflictOption = ConflictOption.CompareRowVersion;
            ArgumentOutOfRangeException ex = Assert.Throws <ArgumentOutOfRangeException>(() => cb.ConflictOption = (ConflictOption)666);

            // The ConflictOption enumeration value, 666, is invalid
            Assert.Null(ex.InnerException);
            Assert.NotNull(ex.Message);
            Assert.Contains("ConflictOption", ex.Message);
            Assert.Contains("666", ex.Message);
            Assert.Equal("ConflictOption", ex.ParamName);

            Assert.Equal(ConflictOption.CompareRowVersion, cb.ConflictOption);
        }
コード例 #12
0
        public void QuoteSuffix()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            Assert.Equal(string.Empty, cb.QuoteSuffix);
            cb.QuoteSuffix = "mono";
            Assert.Equal("mono", cb.QuoteSuffix);
            cb.QuoteSuffix = null;
            Assert.Equal(string.Empty, cb.QuoteSuffix);
            cb.QuoteSuffix = "'\"";
            Assert.Equal("'\"", cb.QuoteSuffix);
            cb.QuoteSuffix = string.Empty;
            Assert.Equal(string.Empty, cb.QuoteSuffix);
            cb.QuoteSuffix = " ";
            Assert.Equal(" ", cb.QuoteSuffix);
        }
コード例 #13
0
        public void QuoteSuffix()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            Assert.AreEqual(string.Empty, cb.QuoteSuffix, "#1");
            cb.QuoteSuffix = "mono";
            Assert.AreEqual("mono", cb.QuoteSuffix, "#2");
            cb.QuoteSuffix = null;
            Assert.AreEqual(string.Empty, cb.QuoteSuffix, "#3");
            cb.QuoteSuffix = "'\"";
            Assert.AreEqual("'\"", cb.QuoteSuffix, "#4");
            cb.QuoteSuffix = string.Empty;
            Assert.AreEqual(string.Empty, cb.QuoteSuffix, "#5");
            cb.QuoteSuffix = " ";
            Assert.AreEqual(" ", cb.QuoteSuffix, "#6");
        }
コード例 #14
0
        public void CatalogSeparator()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            Assert.Equal(".", cb.CatalogSeparator);
            cb.CatalogSeparator = "a";
            Assert.Equal("a", cb.CatalogSeparator);
            cb.CatalogSeparator = null;
            Assert.Equal(".", cb.CatalogSeparator);
            cb.CatalogSeparator = "b";
            Assert.Equal("b", cb.CatalogSeparator);
            cb.CatalogSeparator = string.Empty;
            Assert.Equal(".", cb.CatalogSeparator);
            cb.CatalogSeparator = " ";
            Assert.Equal(" ", cb.CatalogSeparator);
        }
コード例 #15
0
		public void CatalogLocation_Value_Invalid ()
		{
			MyCommandBuilder cb = new MyCommandBuilder ();
			cb.CatalogLocation = CatalogLocation.End;
			try {
				cb.CatalogLocation = (CatalogLocation) 666;
				Assert.Fail ("#1");
			} catch (ArgumentOutOfRangeException ex) {
				// The CatalogLocation enumeration value, 666, is invalid
				Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
				Assert.IsTrue (ex.Message.IndexOf ("CatalogLocation") != -1, "#5:" + ex.Message);
				Assert.IsTrue (ex.Message.IndexOf ("666") != -1, "#6:" + ex.Message);
				Assert.AreEqual ("CatalogLocation", ex.ParamName, "#7");
			}
			Assert.AreEqual (CatalogLocation.End, cb.CatalogLocation, "#8");
		}
コード例 #16
0
        public void ConflictOption_Value_Invalid()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            cb.ConflictOption = ConflictOption.CompareRowVersion;
            try {
                cb.ConflictOption = (ConflictOption)666;
                Assert.Fail("#1");
            } catch (ArgumentOutOfRangeException ex) {
                // The ConflictOption enumeration value, 666, is invalid
                Assert.AreEqual(typeof(ArgumentOutOfRangeException), ex.GetType(), "#2");
                Assert.IsNull(ex.InnerException, "#3");
                Assert.IsNotNull(ex.Message, "#4");
                Assert.IsTrue(ex.Message.IndexOf("ConflictOption") != -1, "#5:" + ex.Message);
                Assert.IsTrue(ex.Message.IndexOf("666") != -1, "#6:" + ex.Message);
                Assert.AreEqual("ConflictOption", ex.ParamName, "#7");
            }
            Assert.AreEqual(ConflictOption.CompareRowVersion, cb.ConflictOption, "#8");
        }
コード例 #17
0
        public void CatalogLocation_Value_Invalid()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            cb.CatalogLocation = CatalogLocation.End;
            try {
                cb.CatalogLocation = (CatalogLocation)666;
                Assert.Fail("#1");
            } catch (ArgumentOutOfRangeException ex) {
                // The CatalogLocation enumeration value, 666, is invalid
                Assert.AreEqual(typeof(ArgumentOutOfRangeException), ex.GetType(), "#2");
                Assert.IsNull(ex.InnerException, "#3");
                Assert.IsNotNull(ex.Message, "#4");
                Assert.IsTrue(ex.Message.IndexOf("CatalogLocation") != -1, "#5:" + ex.Message);
                Assert.IsTrue(ex.Message.IndexOf("666") != -1, "#6:" + ex.Message);
#if !SILVERLIGHT
                Assert.AreEqual("CatalogLocation", ex.ParamName, "#7");
#endif
            }
            Assert.AreEqual(CatalogLocation.End, cb.CatalogLocation, "#8");
        }
コード例 #18
0
ファイル: DbCommandBuilderTest.cs プロジェクト: dotnet/corefx
 public void CatalogLocation_Value_Invalid()
 {
     MyCommandBuilder cb = new MyCommandBuilder();
     cb.CatalogLocation = CatalogLocation.End;
     try
     {
         cb.CatalogLocation = (CatalogLocation)666;
         Assert.False(true);
     }
     catch (ArgumentOutOfRangeException ex)
     {
         // The CatalogLocation enumeration value, 666, is invalid
         Assert.Equal(typeof(ArgumentOutOfRangeException), ex.GetType());
         Assert.Null(ex.InnerException);
         Assert.NotNull(ex.Message);
         Assert.True(ex.Message.IndexOf("CatalogLocation") != -1);
         Assert.True(ex.Message.IndexOf("666") != -1);
         Assert.Equal("CatalogLocation", ex.ParamName);
     }
     Assert.Equal(CatalogLocation.End, cb.CatalogLocation);
 }
コード例 #19
0
        public void ConflictOption_Value_Invalid()
        {
            MyCommandBuilder cb = new MyCommandBuilder();

            cb.ConflictOption = ConflictOption.CompareRowVersion;
            try
            {
                cb.ConflictOption = (ConflictOption)666;
                Assert.False(true);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                // The ConflictOption enumeration value, 666, is invalid
                Assert.Equal(typeof(ArgumentOutOfRangeException), ex.GetType());
                Assert.Null(ex.InnerException);
                Assert.NotNull(ex.Message);
                Assert.True(ex.Message.IndexOf("ConflictOption") != -1);
                Assert.True(ex.Message.IndexOf("666") != -1);
                Assert.Equal("ConflictOption", ex.ParamName);
            }
            Assert.Equal(ConflictOption.CompareRowVersion, cb.ConflictOption);
        }
コード例 #20
0
ファイル: DbCommandBuilderTest.cs プロジェクト: dotnet/corefx
        [Fact] // QuoteIdentifier (String)
        public void QuoteIdentifier()
        {
            MyCommandBuilder cb = new MyCommandBuilder();
            try
            {
                cb.QuoteIdentifier(null);
                Assert.False(true);
            }
            catch (NotSupportedException ex)
            {
                Assert.Equal(typeof(NotSupportedException), ex.GetType());
                Assert.Null(ex.InnerException);
                Assert.Equal((new NotSupportedException()).Message, ex.Message);
            }

            try
            {
                cb.QuoteIdentifier("mono");
                Assert.False(true);
            }
            catch (NotSupportedException ex)
            {
                Assert.Equal(typeof(NotSupportedException), ex.GetType());
                Assert.Null(ex.InnerException);
                Assert.Equal((new NotSupportedException()).Message, ex.Message);
            }
        }
コード例 #21
0
ファイル: DbCommandBuilderTest.cs プロジェクト: dotnet/corefx
 public void QuoteSuffix()
 {
     MyCommandBuilder cb = new MyCommandBuilder();
     Assert.Equal(string.Empty, cb.QuoteSuffix);
     cb.QuoteSuffix = "mono";
     Assert.Equal("mono", cb.QuoteSuffix);
     cb.QuoteSuffix = null;
     Assert.Equal(string.Empty, cb.QuoteSuffix);
     cb.QuoteSuffix = "'\"";
     Assert.Equal("'\"", cb.QuoteSuffix);
     cb.QuoteSuffix = string.Empty;
     Assert.Equal(string.Empty, cb.QuoteSuffix);
     cb.QuoteSuffix = " ";
     Assert.Equal(" ", cb.QuoteSuffix);
 }
コード例 #22
0
		public void QuoteSuffix ()
		{
			MyCommandBuilder cb = new MyCommandBuilder ();
			Assert.AreEqual (string.Empty, cb.QuoteSuffix, "#1");
			cb.QuoteSuffix = "mono";
			Assert.AreEqual ("mono", cb.QuoteSuffix, "#2");
			cb.QuoteSuffix = null;
			Assert.AreEqual (string.Empty, cb.QuoteSuffix, "#3");
			cb.QuoteSuffix = "'\"";
			Assert.AreEqual ("'\"", cb.QuoteSuffix, "#4");
			cb.QuoteSuffix = string.Empty;
			Assert.AreEqual (string.Empty, cb.QuoteSuffix, "#5");
			cb.QuoteSuffix = " ";
			Assert.AreEqual (" ", cb.QuoteSuffix, "#6");
		}
コード例 #23
0
		[Test] // QuoteIdentifier (String)
		public void QuoteIdentifier ()
		{
			MyCommandBuilder cb = new MyCommandBuilder ();
			try {
				cb.QuoteIdentifier ((string) null);
				Assert.Fail ("#A1");
			} catch (NotSupportedException ex) {
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#A2");
				Assert.IsNull (ex.InnerException, "#A3");
				Assert.AreEqual ((new NotSupportedException ()).Message, ex.Message, "#A4");
			}

			try {
				cb.QuoteIdentifier ("mono");
				Assert.Fail ("#B1");
			} catch (NotSupportedException ex) {
				Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#B2");
				Assert.IsNull (ex.InnerException, "#B3");
				Assert.AreEqual ((new NotSupportedException ()).Message, ex.Message, "#B4");
			}
		}
コード例 #24
0
		public void ConflictOption_Value_Invalid ()
		{
			MyCommandBuilder cb = new MyCommandBuilder ();
			cb.ConflictOption = ConflictOption.CompareRowVersion;
			try {
				cb.ConflictOption = (ConflictOption) 666;
				Assert.Fail ("#1");
			} catch (ArgumentOutOfRangeException ex) {
				// The ConflictOption enumeration value, 666, is invalid
				Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
				Assert.IsTrue (ex.Message.IndexOf ("ConflictOption") != -1, "#5:" + ex.Message);
				Assert.IsTrue (ex.Message.IndexOf ("666") != -1, "#6:" + ex.Message);
#if !SILVERLIGHT
				Assert.AreEqual ("ConflictOption", ex.ParamName, "#7");
#endif
			}
			Assert.AreEqual (ConflictOption.CompareRowVersion, cb.ConflictOption, "#8");
		}