Skip to content

Commit

Permalink
Remove DbContextScaffoldCommand_accepts_separate_context_output_path …
Browse files Browse the repository at this point in the history
…from CommandTest.
  • Loading branch information
Anthony Sneed committed Dec 8, 2017
1 parent cb501d5 commit 1c3eea8
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions test/ef.Tests/CommandsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.EntityFrameworkCore.Tools.Commands;
Expand All @@ -28,49 +26,6 @@ public void Short_names_are_unique()
}
}

[Theory]
[InlineData("FakeOutputDir", null)]
[InlineData("FakeOutputDir", "FakeOutputDir")]
[InlineData("FakeOutputDir", "FakeDbContextOutputDir")]
public void DbContextScaffoldCommand_accepts_separate_context_output_path(string outputDir, string outputDbContextDir)
{
const string contextClassName = "FakeDbContextClassName";
var scaffoldCommand = GetScaffoldCommand();
var connectionString = new SqlConnectionStringBuilder
{
DataSource = @"(localdb)\MSSQLLocalDB",
InitialCatalog = "CommandConfiguration", // TODO: Ensure database exists
IntegratedSecurity = true,
}.ConnectionString;
var args = new[]
{
"scaffold",
connectionString,
"Microsoft.EntityFrameworkCore.SqlServer",
"--language:C#",
"-a:ef.Tests",
"-f",
$"-c:{contextClassName}",
$"--output-dir:{outputDir}",
$"--output-dbcontext-dir:{outputDbContextDir}",
};

var expectedOutputDir = outputDir;
if (outputDbContextDir != null && outputDbContextDir != outputDir)
{
expectedOutputDir = outputDbContextDir;
}
var expectedOutputPath = Path.Combine(expectedOutputDir, $"{contextClassName}.cs");
if (File.Exists(expectedOutputPath))
{
File.Delete(expectedOutputPath);
}

scaffoldCommand.Execute(args);

Assert.True(File.Exists(expectedOutputPath));
}

private static CommandLineApplication GetScaffoldCommand()
{
var app = new CommandLineApplication
Expand Down

0 comments on commit 1c3eea8

Please sign in to comment.