-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gman-au/develop
Develop
- Loading branch information
Showing
24 changed files
with
432 additions
and
191 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
20 changes: 17 additions & 3 deletions
20
...ations/20240820031016_Initial.Designer.cs → ...ations/20240822051235_Initial.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System.Threading.Tasks; | ||
using Not.Again.Domain; | ||
using Not.Again.Interfaces; | ||
|
||
namespace Not.Again.Database | ||
{ | ||
public class TestAssemblyPutter : ITestAssemblyPutter | ||
{ | ||
private const string UnknownTestRunner = "Unknown"; | ||
|
||
private readonly NotAgainDbContext _context; | ||
private readonly ITestAssemblyGetter _testAssemblyGetter; | ||
|
||
public TestAssemblyPutter( | ||
NotAgainDbContext context, | ||
ITestAssemblyGetter testAssemblyGetter) | ||
{ | ||
_testAssemblyGetter = testAssemblyGetter; | ||
_context = context; | ||
} | ||
|
||
public async Task<TestAssembly> AddOrUpdateTestAssemblyAsync( | ||
string assemblyName, | ||
string testRunner | ||
) | ||
{ | ||
testRunner = string.IsNullOrEmpty(testRunner) ? UnknownTestRunner : testRunner; | ||
|
||
var testAssembly = new TestAssembly | ||
{ | ||
TestAssemblyName = assemblyName, | ||
TestRunner = testRunner | ||
}; | ||
|
||
var dbTestAssembly = | ||
await | ||
_testAssemblyGetter | ||
.GetAsync(testAssembly); | ||
|
||
if (dbTestAssembly == null) | ||
{ | ||
dbTestAssembly = | ||
(await | ||
_context | ||
.TestAssembly | ||
.AddAsync(testAssembly)) | ||
.Entity; | ||
|
||
await | ||
_context | ||
.SaveChangesAsync(); | ||
} | ||
|
||
return dbTestAssembly; | ||
} | ||
} | ||
} |
Oops, something went wrong.