56 lines
2.0 KiB
C#
56 lines
2.0 KiB
C#
using NUnit.Framework;
|
|
using Strata.RxNorm.Biz.Jazz;
|
|
using Strata.RxNorm.Biz.Test.Unit.Extensions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using VerifyTests;
|
|
|
|
namespace Strata.RxNorm.Biz.Test.Unit.Ndc
|
|
{
|
|
[TestFixture]
|
|
public class DimNdcTests
|
|
{
|
|
public VerifySettings VerifySetting { get; set; }
|
|
|
|
[OneTimeSetUp]
|
|
public void Setup()
|
|
{
|
|
VerifySetting = TestExtensions.TestSettings();
|
|
VerifySetting.UseDirectory("snapshots");
|
|
}
|
|
|
|
[TestCaseSource(nameof(DimNdcNormalizeTestCases))]
|
|
public async Task TestDimNdcNormalize(string ndcCode, string expected)
|
|
{
|
|
var dimNdc = new DimNdc
|
|
{
|
|
NdcCode = ndcCode,
|
|
NormalizedNdcCode = ndcCode.NormalizeNdc()
|
|
};
|
|
Console.WriteLine($"'{dimNdc.NdcCode}' is normalized to '{dimNdc.NormalizedNdcCode}' == '{expected}'");
|
|
Assert.That(dimNdc.NormalizedNdcCode, Is.EqualTo(expected));
|
|
}
|
|
|
|
public static IEnumerable<TestCaseData> DimNdcNormalizeTestCases()
|
|
{
|
|
yield return new TestCaseData("000406-0522-05", "00406052205")
|
|
.SetName("{m} {0} -> {1}");
|
|
yield return new TestCaseData("054868-5338-*3", "54868533803")
|
|
.SetName("{m} {0} -> {1}");
|
|
yield return new TestCaseData("0591-0933-01", "00591093301")
|
|
.SetName("{m} {0} -> {1}");
|
|
yield return new TestCaseData("60951-700-85", "60951070085")
|
|
.SetName("{m} {0} -> {1}");
|
|
yield return new TestCaseData("0406052201", "")
|
|
.SetName("{m} {0} -> {1}");
|
|
yield return new TestCaseData("00406052201", "00406052201")
|
|
.SetName("{m} {0} -> {1}");
|
|
yield return new TestCaseData("00406052201", "00406052201")
|
|
.SetName("{m} {0} -> {1}");
|
|
yield return new TestCaseData("*00406052201", "00406052201")
|
|
.SetName("{m} {0} -> {1}");
|
|
}
|
|
}
|
|
}
|