public void RuleNotSupportCheckTest() { var mockVersionHelper = new Mock<IDataVersioningHelper>(); var mockRepository = new Mock<IRepository<CV_RelationshipType>>(); var testTool = new SampleMatrixTypeCheckingTool(mockVersionHelper.Object, mockRepository.Object); var mockQualityCheckingRule = new Mock<IDataQualityCheckingRule>(); var dataNotSupportCheckResult = testTool.Check(new Hatfield.EnviroData.Core.Action(), mockQualityCheckingRule.Object); Assert.NotNull(dataNotSupportCheckResult); Assert.AreEqual("Data Quality Checking Rule is not supported by the Quality Checking Tool.", dataNotSupportCheckResult.Message); Assert.False(dataNotSupportCheckResult.NeedCorrection); Assert.AreEqual(QualityCheckingResultLevel.Error, dataNotSupportCheckResult.Level); }
public void DataNotSupportCheckTest() { var mockVersionHelper = new Mock<IDataVersioningHelper>(); var mockRepository = new Mock<IRepository<CV_RelationshipType>>(); var testTool = new SampleMatrixTypeCheckingTool(mockVersionHelper.Object, mockRepository.Object); var testQualityCheckingRule = new StringCompareCheckingRule("test", false, "test"); var dataNotSupportCheckResult = testTool.Check(1, testQualityCheckingRule); Assert.NotNull(dataNotSupportCheckResult); Assert.AreEqual("Data is not supported by the Quality Checking Tool.", dataNotSupportCheckResult.Message); Assert.False(dataNotSupportCheckResult.NeedCorrection); Assert.AreEqual(QualityCheckingResultLevel.Error, dataNotSupportCheckResult.Level); }
public void ValidCheckTest() { var testActionData = CreateTestAction(); var testQualityCheckingRule = new StringCompareCheckingRule("Water", false, "test"); var mockVersionHelper = new Mock<IDataVersioningHelper>(); mockVersionHelper.Setup(x => x.GetLatestVersionActionData(It.IsAny<Hatfield.EnviroData.Core.Action>())).Returns(testActionData); var mockRepository = new Mock<IRepository<CV_RelationshipType>>(); var testTool = new SampleMatrixTypeCheckingTool(mockVersionHelper.Object, mockRepository.Object); var qcResult = testTool.Check(testActionData, testQualityCheckingRule); var expextedMessageBuilder = new StringBuilder(); expextedMessageBuilder.AppendLine("Sample Result: abdc02ff-4bc6-4b8c-8578-e3c8d3620cea on May-01-2015's sample matrix meets the expected value."); expextedMessageBuilder.AppendLine("Sample Result: abdc02ff-4bc6-4b8c-8578-e3c8d3620cea's sample matrix meets the expected value."); expextedMessageBuilder.AppendLine("Sample Result: abdc02ff-4bc6-4b8c-8578-e3c8d3620cea on May-01-2015's sample matrix value is test type, the expected value is Water. Need data correction."); expextedMessageBuilder.AppendLine("Sample Result: abdc02ff-4bc6-4b8c-8578-e3c8d3620cea on May-01-2015 does not contain sample matrix data."); Assert.AreEqual(expextedMessageBuilder.ToString(), qcResult.Message); Assert.True(qcResult.NeedCorrection); Assert.AreEqual(QualityCheckingResultLevel.Info, qcResult.Level); }