public void InitializeFixture() { _builder = UnitTestHelper.FakeBuilder.Object; _token = new CancellationToken(); SuccessPledgeResult = new PledgeResult { FileHasValidRecords = true, TotalRecordsProcessed = 3}; FailPledgeResult = new PledgeResult { FileHasInvalidRecords = true, TotalRecordsProcessed = 3 }; PartialPledgeResult = new PledgeResult { FileHasValidRecords = true, FileHasInvalidRecords = true, TotalRecordsProcessed = 3 }; }
internal static Mock<IPledge> Initialize(MoqMockingKernel kernel) { SuccessPledgeResult = new PledgeResult { FileHasValidRecords = true, TotalRecordsProcessed = 3}; FailPledgeResult = new PledgeResult { FileHasInvalidRecords = true, TotalRecordsProcessed = 3 }; PartialPledgeResult = new PledgeResult { FileHasValidRecords = true, FileHasInvalidRecords = true, TotalRecordsProcessed = 3 }; var pledge = kernel.GetMock<IPledge>(); pledge.Setup( mock => mock.Run(FakeConfigurationManager.Configuration, It.IsAny<IRemoteJob>(),It.IsAny<string>())).Returns(SuccessPledgeResult); return pledge; }
private void RunTestForAllRecord(string first, string second, string third, string fourth, IPledgeResult expectedResult, int numberOfExpectedGoodRecords) { Reload(first, second, third, fourth); RunTest(expectedResult, numberOfExpectedGoodRecords); }
private void RunTest(IPledgeResult expectedResult, int numberOfExpectedGoodRecords) { var numberOfBadRecords = FakeIngest.TotalRecords - numberOfExpectedGoodRecords; var result = _pipeline.Run(_token); Assert.AreEqual(expectedResult.FileHasInvalidRecords, result.PledgeResult.FileHasInvalidRecords, "The validator did not return the expected result"); Assert.AreEqual(expectedResult.FileHasValidRecords, result.PledgeResult.FileHasValidRecords, "The validator did not return the expected result"); Assert.AreEqual(expectedResult.TotalRecordsProcessed, result.PledgeResult.TotalRecordsProcessed, "Total records count are different"); Assert.AreEqual(numberOfExpectedGoodRecords, result.PledgeResult.TotalPassedRecordsCount, "Total good records count are different"); Assert.AreEqual(numberOfBadRecords, result.PledgeResult.TotalFailedRecordsCount, "Total bad records count are different"); }
private void RunTestForSingleRecord(int row, string first, string second, string third, string fourth, IPledgeResult expectedResult, int numberOfExpectedGoodRecords, bool hasHeader = false) { Reload(row, first, second, third, fourth, hasHeader); RunTest(expectedResult, numberOfExpectedGoodRecords); }