Created
July 4, 2019 10:45
-
-
Save kurtmkurtm/900120c7b505fcc9bbc579e24f4eeebb to your computer and use it in GitHub Desktop.
xUnit - UserFact Test Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data; | |
using Xunit; | |
using Xunit.UserContext; | |
using System.Data.SqlClient; | |
namespace medium | |
{ | |
public class UnitTest1 | |
{ | |
[UserFact(userSecretsId: "MyTestId")] | |
public void Test1() | |
{ | |
var connectionState = ConnectionState.Closed; | |
var connectionString = @"Data Source=localhost\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=Test;"; | |
using (var connection = new SqlConnection(connectionString)) | |
{ | |
connection.Open(); | |
connectionState = connection.State; | |
} | |
Assert.Equal(ConnectionState.Open, connectionState); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment