/// <summary> /// Initializes a new instance of the <see cref="Registry"/> class. /// </summary> private Registry() { CertificateRepository = new CertificateRepository(); MessageBodyStore = new MessageBodyStore(); MessageBodyStore.Accept( condition: l => l.StartsWith("file:///", StringComparison.OrdinalIgnoreCase), persister: new AS4MessageBodyFileStore()); }
public async Task MessageEntityCatchesInvalidMessageBodyRetrieval() { // Arrange StubMessageEntity sut = CreateMessageEntity(messageLocation: "ignored"); var stubProvider = new MessageBodyStore(); stubProvider.Accept(condition: s => true, persister: new SaboteurMessageBodyStore()); // Act using (Stream actualStream = await sut.RetrieveMessageBody(stubProvider)) { // Assert Assert.Null(actualStream); } }
private static void TestProviderWithAcceptedPersister( Action <MessageBodyStore> act, Expression <Action <IAS4MessageBodyStore> > assertion) { // Arrange var spyPersister = Mock.Of <IAS4MessageBodyStore>(); var sut = new MessageBodyStore(); sut.Accept(location => true, spyPersister); // Act act(sut); // Assert Mock.Get(spyPersister).Verify(assertion, Times.Once); }