private static IReadOnlyList <TestCase> LoadTestCases() { var expectedPath = TestContext.Parameters.Get(ConfigurationConstants.ExpectedUtterancesPathKey) ?? "expected.json"; var actualPath = TestContext.Parameters.Get(ConfigurationConstants.ActualUtterancesPathKey) ?? "actual.json"; if (string.IsNullOrEmpty(expectedPath) || string.IsNullOrEmpty(actualPath)) { throw new InvalidOperationException("Could not find configuration for expected or actual utterances."); } var testSettingsPath = TestContext.Parameters.Get(ConfigurationConstants.TestSettingsPathKey); var unitTestModeString = TestContext.Parameters.Get(ConfigurationConstants.UnitTestModeKey); if (unitTestModeString == null || !bool.TryParse(unitTestModeString, out var unitTestMode)) { unitTestMode = false; } var testSettings = new TestSettings(testSettingsPath, unitTestMode); var expected = Read(expectedPath); var actual = Read(actualPath); return(GetNLUCompareResults(expected, actual, testSettings).TestCases); }
private static bool IsStrictEntity( string entityType, ILabeledUtterance expectedUtterance, TestSettings testSettings) { var localIgnoreEntities = expectedUtterance.GetIgnoreEntities(); var localStrictEntities = expectedUtterance.GetStrictEntities(); if (!testSettings.UnitTestMode) { var globalIgnoreEntities = testSettings.IgnoreEntities; return(!localIgnoreEntities .Union(globalIgnoreEntities) .Except(localStrictEntities) .Contains(entityType)); } var globalStrictEntities = testSettings.StrictEntities; return(localStrictEntities .Union(globalStrictEntities) .Except(localIgnoreEntities) .Contains(entityType)); }