-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix command-line options (#132) * [DotLiquid] Refine template loading performance (#138) * Refine template loading * Copy list of dictionary in template provider * Add TemplateLocalFileSystem * Fix typo * fix bug for pull templates CLI (#145) * update readme (#135) * update readme * update readme * update readme * update doc * refine CLI options and fix typo (#144) * fix typo and refine commandline description * fix typo * [DotLiquid] Add description for "-t" option (#147) * Fixed FHIR server name (#143) * Add description for -t * Remove extra period * Remove unused sentence * Refine template zip name Co-authored-by: Ranvijay Kumar <[email protected]> * Fixed FHIR server name (#143) (#150) Co-authored-by: Ranvijay Kumar <[email protected]> Co-authored-by: Boya Wu <[email protected]> Co-authored-by: sowu880 <[email protected]> Co-authored-by: Ranvijay Kumar <[email protected]>
- Loading branch information
1 parent
fd19cc2
commit c6a87f8
Showing
17 changed files
with
307 additions
and
111 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
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
56 changes: 56 additions & 0 deletions
56
...crosoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/TemplateLocalFileSystemTests.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,56 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Globalization; | ||
using DotLiquid; | ||
using Microsoft.Health.Fhir.Liquid.Converter.DotLiquids; | ||
using Microsoft.Health.Fhir.Liquid.Converter.Exceptions; | ||
using Microsoft.Health.Fhir.Liquid.Converter.Models; | ||
using Xunit; | ||
|
||
namespace Microsoft.Health.Fhir.Liquid.Converter.UnitTests.DotLiquids | ||
{ | ||
public class TemplateLocalFileSystemTests | ||
{ | ||
[Fact] | ||
public void GivenAValidTemplateDirectory_WhenGetTemplate_CorrectResultsShouldBeReturned() | ||
{ | ||
var templateLocalFileSystem = new TemplateLocalFileSystem(Constants.Hl7v2TemplateDirectory, DataType.Hl7v2); | ||
var context = new Context(CultureInfo.InvariantCulture); | ||
|
||
// Template exists | ||
Assert.NotNull(templateLocalFileSystem.GetTemplate("ADT_A01")); | ||
|
||
// Template does not exist | ||
Assert.Null(templateLocalFileSystem.GetTemplate("Foo")); | ||
} | ||
|
||
[Fact] | ||
public void GivenAValidTemplateDirectory_WhenGetTemplateWithContext_CorrectResultsShouldBeReturned() | ||
{ | ||
var templateLocalFileSystem = new TemplateLocalFileSystem(Constants.Hl7v2TemplateDirectory, DataType.Hl7v2); | ||
var context = new Context(CultureInfo.InvariantCulture); | ||
|
||
// Template exists | ||
context["ADT_A01"] = "ADT_A01"; | ||
Assert.NotNull(templateLocalFileSystem.GetTemplate(context, "ADT_A01")); | ||
|
||
// Template does not exist | ||
context["Foo"] = "Foo"; | ||
Assert.Throws<RenderException>(() => templateLocalFileSystem.GetTemplate(context, "Foo")); | ||
Assert.Throws<RenderException>(() => templateLocalFileSystem.GetTemplate(context, "Bar")); | ||
} | ||
|
||
[Fact] | ||
public void GivenAValidTemplateDirectory_WhenReadTemplateWithContext_ExceptionShouldBeThrown() | ||
{ | ||
var templateLocalFileSystem = new TemplateLocalFileSystem(Constants.Hl7v2TemplateDirectory, DataType.Hl7v2); | ||
var context = new Context(CultureInfo.InvariantCulture); | ||
context["ADT_A01"] = "ADT_A01"; | ||
Assert.Throws<NotImplementedException>(() => templateLocalFileSystem.ReadTemplateFile(context, "hello")); | ||
} | ||
} | ||
} |
Oops, something went wrong.