public async Task InvokeAsync_Success(string xsltFileName) { var testClass = new XSLTransformContentMiddleWare( next: ctx => Task.CompletedTask, logger: _loggerFixture.GetMockLogger <XSLTransformContentMiddleWare>(), options: new XSLTransformContentOptions() { XSLTPath = _xsltFixture.GetFullPath(xsltFileName) }); var context = new CFTFileContext( applicationServices: new ServiceCollection().BuildServiceProvider(), inputFile: _xsltFixture.GetFakeFileInfo()); await testClass.InvokeAsync(context); Encoding.Default.GetString(context.OutputFile.FileContent) .Should() .Be(XSLTFixture.CONTENT_DATA_XML_AFTER_XSLT); }
public async Task InvokeAsync_Success_DTD_Namespace() { var next = GetNextDelegate(isThrow: false); var testClass = new ValidateByXSDMiddleWare( next: next, logger: _loggerFixture.GetMockLogger <ValidateByXSDMiddleWare>(), options: new ValidateByXSDOptions() { XSDPath = _xsdFixture.GetFullPath(XSDFixture.FILENAME_XSD_NAMESPACE) }); var context = new CFTFileContext( applicationServices: new ServiceCollection().BuildServiceProvider(), inputFile: _xmlFixture.GetFakeFileInfo(XMLFixture.XMLType.DTD_NAMESPACE)); Action call = () => testClass.InvokeAsync(context).GetAwaiter().GetResult(); call.Should().NotThrow(); A.CallTo(() => next.Invoke(A <CFTFileContext> .That.Matches((ctx) => ctx == context))) .MustHaveHappenedOnceExactly(); }