コード例 #1
0
            public async Task ReadMetadata()
            {
                // Given
                System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en");
                IReadOnlyList <TestDocument> documents = GetDocumentsFromSources(Path.Combine(TestContext.CurrentContext.TestDirectory, "Samples", "Flamme.png"));
                ReadXmp directoryMetadata = new ReadXmp()
                                            .WithMetadata("xmpRights:UsageTerms", "Copyright");

                // When
                IReadOnlyList <TestDocument> results = await ExecuteAsync(documents, directoryMetadata);

                // Then
                results.Single()["Copyright"]
                .ShouldBe("This work is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/4.0/\">Creative Commons Attribution-ShareAlike 4.0 International License</a>.");
            }
コード例 #2
0
            public async Task DontSkipMissingMandatory()
            {
                // Given
                System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en");
                IReadOnlyList <TestDocument> documents = GetDocumentsFromSources(
                    Path.Combine(TestContext.CurrentContext.TestDirectory, "Samples", "Flamme.png"),
                    Path.Combine(TestContext.CurrentContext.TestDirectory, "Samples", "RomantiqueInitials.ttf"));
                ReadXmp directoryMetadata = new ReadXmp(skipElementOnMissingMandatoryData: false)
                                            .WithMetadata("xmpRights:UsageTerms", "Copyright", true);
                TestExecutionContext context = new TestExecutionContext(documents);

                context.TestLoggerProvider.ThrowLogLevel = LogLevel.Error;

                // When
                IReadOnlyList <TestDocument> results = await ExecuteAsync(context, directoryMetadata);

                // Then
                results.Count.ShouldBe(2);
            }