-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Code changes * Minor refactor tests name * Addresses feedback * Adds unit test and refactoring * Implements diff api * Adds a unit test * Addresses feedback * Refactoring and updates the script uri * Minor refactor * Minor changes for complete status
- Loading branch information
Showing
19 changed files
with
184 additions
and
68 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
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
1 change: 1 addition & 0 deletions
1
src/Microsoft.Health.SqlServer.UnitTests/Features/Schema/Migrations/1.sql
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 @@ | ||
SELECT 1 |
1 change: 1 addition & 0 deletions
1
src/Microsoft.Health.SqlServer.UnitTests/Features/Schema/Migrations/2.diff.sql
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 @@ | ||
SELECT 1 |
48 changes: 48 additions & 0 deletions
48
src/Microsoft.Health.SqlServer.UnitTests/Features/Schema/ScriptProviderTests.cs
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,48 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System.IO; | ||
using System.Threading.Tasks; | ||
using Microsoft.Health.SqlServer.Features.Schema; | ||
using Xunit; | ||
|
||
namespace Microsoft.Health.SqlServer.UnitTests.Features.Schema | ||
{ | ||
public class ScriptProviderTests | ||
{ | ||
private readonly ScriptProvider<TestSchemaVersionEnum> _scriptProvider; | ||
|
||
public ScriptProviderTests() | ||
{ | ||
_scriptProvider = new ScriptProvider<TestSchemaVersionEnum>(); | ||
} | ||
|
||
[Fact] | ||
public async Task GivenASnapshotScript_WhenGetDiffScriptAsBytesAsync_ThenReturnsDiffScriptAsync() | ||
{ | ||
Assert.NotNull(await _scriptProvider.GetDiffScriptAsBytesAsync(2, default)); | ||
} | ||
|
||
[Fact] | ||
public async Task GivenADiffScript_WhenGetSnapshotScriptAsBytesAsync_ThenReturnsSnapshotScriptAsync() | ||
{ | ||
Assert.NotNull(await _scriptProvider.GetScriptAsBytesAsync(1, default)); | ||
} | ||
|
||
[Fact] | ||
public async Task GivenASnapshotScriptNotPresent_WhenGetSnapshotScriptAsBytesAsync_ThenReturnsFileNotFoundException() | ||
{ | ||
FileNotFoundException ex = await Assert.ThrowsAsync<FileNotFoundException>(() => _scriptProvider.GetScriptAsBytesAsync(2, default)); | ||
Assert.Equal("The provided version is unknown.", ex.Message); | ||
} | ||
|
||
[Fact] | ||
public async Task GivenADiffScriptNotPresent_WhenGetDiffScriptAsBytesAsync_ThenReturnsFileNotFoundException() | ||
{ | ||
FileNotFoundException ex = await Assert.ThrowsAsync<FileNotFoundException>(() => _scriptProvider.GetDiffScriptAsBytesAsync(1, default)); | ||
Assert.Equal("The provided version is unknown.", ex.Message); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Microsoft.Health.SqlServer.UnitTests/Features/Schema/TestSchemaVersionEnum.cs
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,13 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Health.SqlServer.UnitTests.Features.Schema | ||
{ | ||
public enum TestSchemaVersionEnum | ||
{ | ||
Version1 = 1, | ||
Version2 = 2, | ||
} | ||
} |
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 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 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
Oops, something went wrong.