-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into users/shshetty/GalleryIssue
- Loading branch information
Showing
36 changed files
with
350 additions
and
221 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,38 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.PowerPlatform.PowerApps.Persistence.YamlValidator; | ||
|
||
|
||
namespace Persistence.YamlValidator.Tests; | ||
public abstract class TestBase : VSTestBase | ||
{ | ||
public static IServiceProvider ServiceProvider { get; set; } | ||
public IValidatorFactory ValidatorFactory { get; private set; } | ||
|
||
static TestBase() | ||
{ | ||
ServiceProvider = BuildServiceProvider(); | ||
} | ||
|
||
public TestBase() | ||
{ | ||
ValidatorFactory = ServiceProvider.GetRequiredService<IValidatorFactory>(); | ||
} | ||
|
||
private static ServiceProvider BuildServiceProvider() | ||
{ | ||
var serviceCollection = new ServiceCollection(); | ||
var serviceProvider = ConfigureServices(serviceCollection); | ||
|
||
return serviceProvider; | ||
} | ||
|
||
private static ServiceProvider ConfigureServices(IServiceCollection services) | ||
{ | ||
services.AddPowerAppsPersistenceYamlValidator(); | ||
|
||
return services.BuildServiceProvider(); | ||
} | ||
|
||
} |
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,16 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace Persistence.YamlValidator.Tests; | ||
|
||
/// <summary> | ||
/// Represents a shared base class for any test class that uses the Visual Studio Test Framework. | ||
/// </summary> | ||
/// <remarks> | ||
/// DO NOT add any setup/tear down logic to this class, as not all tests may require it. | ||
/// The preferred approach is to use a different derived base class for tests that require setup/tear down logic specific to some shared scenarios. | ||
/// </remarks> | ||
public abstract class VSTestBase | ||
{ | ||
public required TestContext TestContext { get; set; } | ||
} |
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,20 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.PowerPlatform.PowerApps.Persistence.YamlValidator; | ||
|
||
namespace Persistence.YamlValidator.Tests; | ||
|
||
[TestClass] | ||
public class ValidatorFactoryTest : TestBase | ||
{ | ||
[TestMethod] | ||
public void GetValidatorTest() | ||
{ | ||
var factory = new ValidatorFactory(); | ||
var validator = factory.CreateValidator(); | ||
|
||
Assert.IsNotNull(validator); | ||
Assert.IsInstanceOfType(validator, typeof(IValidator)); | ||
} | ||
} |
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.