Skip to content

Commit

Permalink
chore(test): create data folder in state handler if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Oct 8, 2024
1 parent ffeeb5b commit d504dd9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode/
bin/
obj/
pacts/
pacts/
data/
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ private async Task RemoveAllData(IDictionary<string, object> parameters)
private async Task AddData(IDictionary<string, object> parameters)
{
string path = Path.Combine(Directory.GetCurrentDirectory(), @"../../../../../data");

// Create the directory if it doesn't exist
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}

var writePath = Path.Combine(path, "somedata.txt");

if (!File.Exists(writePath))
Expand Down
14 changes: 14 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,13 @@ The code for this looks like:
private async Task AddData(IDictionary<string, object> parameters)
{
string path = Path.Combine(Directory.GetCurrentDirectory(), @"../../../../../data");

// Create the directory if it doesn't exist
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}

var writePath = Path.Combine(path, "somedata.txt");

if (!File.Exists(writePath))
Expand Down Expand Up @@ -933,6 +940,13 @@ namespace tests.Middleware
private async Task AddData(IDictionary<string, object> parameters)
{
string path = Path.Combine(Directory.GetCurrentDirectory(), @"../../../../../data");

// Create the directory if it doesn't exist
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}

var writePath = Path.Combine(path, "somedata.txt");

if (!File.Exists(writePath))
Expand Down

0 comments on commit d504dd9

Please sign in to comment.