ContentReaderExtensionsTests.cs 1.1 KB

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Reflection;
  5. using MonoGame.Extended.Collections;
  6. using MonoGame.Extended.Content;
  7. using Xunit;
  8. namespace MonoGame.Extended.Tests.Content
  9. {
  10. public class ContentReaderExtensionsTests
  11. {
  12. [Theory]
  13. [InlineData("testsuperdir/testsubdir1/testsubdir2/resource", "testsuperdir/testsubdir1/testsubdir2/resource")]
  14. [InlineData("testsuperdir/testsubdir1/../testsubdir2/resource", "testsuperdir/testsubdir2/resource")]
  15. [InlineData("testsuperdir/../resource", "resource")]
  16. [InlineData("../testsuperdir/testsubdir1/../testsubdir2/resource", "../testsuperdir/testsubdir2/resource")]
  17. [InlineData("testsuperdir/testsubdir1/testsubdir2/../../testsubdir3/resource", "testsuperdir/testsubdir3/resource")]
  18. [InlineData("testsuperdir/testsubdir1/../testsubdir2/../testsubdir3/resource", "testsuperdir/testsubdir3/resource")]
  19. public void ContentReaderExtensions_ShortenRelativePath(string input, string expectedoutput)
  20. {
  21. Assert.True(ContentReaderExtensions.ShortenRelativePath(input) == expectedoutput);
  22. }
  23. }
  24. }