public void When_Exporting_810_Then_LDC_Is_Loaded_By_Tdsp_Duns_From_Header() { // arrange var cspDunsPorts = new[] { new CspDunsPortModel { CspDunsId = 17, CspDunsPortId = 117, LdcDuns = "MockTdspDuns_One", LdcShortName = "MockTdspDuns_One", Duns = "MockDuns_One", TradingPartnerId = "Mock_Trade_{DUNS}", ProviderId = 1 } }; var headers = new[] { new Type810Header { HeaderKey = 1, TdspDuns = "Mock_Tdsp_Duns", TdspName = "Mock_Tdsp", CrDuns = "Mock_Cr_Duns", CrName = "Mock_Cr", TotalAmount = "12.33", } }; clientDataAccess.Stub(x => x.ListCspDunsPort()) .Return(cspDunsPorts); exportDataAccess.Stub(x => x.ListUnprocessed(Arg <string> .Is.Anything, Arg <string> .Is.Anything, Arg.Is(1))) .Return(headers); clientDataAccess.Stub(x => x.LoadDunsByCspDunsId(Arg.Is(17))) .Return("Mock_Csp_Duns"); clientDataAccess.Expect(x => x.LoadLdcByTdspDuns(Arg.Is("Mock_Tdsp_Duns"))) .Return(new LdcModel { LdcId = 23, MarketId = 33 }); // act var results = concern.Export(CancellationToken.None); // assert Assert.IsNotNull(results); Assert.AreEqual(1, results.Length); var result = results[0]; Assert.IsNotNull(result); Assert.AreEqual("Mock_Trade_Mock_Tdsp_DunsINV", result.TradingPartnerId); clientDataAccess.VerifyAllExpectations(); }