public void DropDatabase_TooManyValues() { // Arguably this should throw an ArgumentException on construction, but for the moment, we'll // stick with the v1.0 behavior. var builder = SpannerCommandTextBuilder.FromCommandText("DROP DATABASE FOO BAR;"); Assert.Throws <InvalidOperationException>(() => builder.DatabaseToDrop.ToString()); }
public void DropDatabaseNegative(string ddlString) { Assert.Throws <InvalidOperationException>( () => { var builder = new SpannerCommandTextBuilder(ddlString); // ReSharper disable once UnusedVariable string ignored = builder.DatabaseToDrop; }); }
public void DropDatabasePositive(string ddlString) { SpannerCommandTextBuilder builder = new SpannerCommandTextBuilder(ddlString); Assert.True(builder.IsDropDatabaseCommand); Assert.Equal("FOO", builder.DatabaseToDrop); //via spannerconnection as well... using (var connection = new SpannerConnection("Data Source=projects/p/instances/i")) { var command = connection.CreateDdlCommand(ddlString); Assert.True(command.SpannerCommandTextBuilder.IsDropDatabaseCommand); Assert.Equal("FOO", command.SpannerCommandTextBuilder.DatabaseToDrop); } }
public void DropDatabaseUnrecognized(string ddlString) { var builder = new SpannerCommandTextBuilder(ddlString); Assert.False(builder.IsDropDatabaseCommand); }
public void DropDatabase_UnrecognizedCommand() { Assert.Throws <ArgumentException>(() => SpannerCommandTextBuilder.FromCommandText("DROPDATABASE FOO;")); }
public void InvalidCommand(string commandText) => Assert.Throws <ArgumentException>(() => SpannerCommandTextBuilder.FromCommandText(commandText));
public void DdlCommand(string commandText) { var builder = SpannerCommandTextBuilder.FromCommandText(commandText); Assert.Equal(SpannerCommandType.Ddl, builder.SpannerCommandType); }