summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/tests/MonoGame.Extended.Tests/Content/ContentReaderExtensionsTests.cs
blob: e1c701d662dfc43f176beb1e689b1aae535cd5a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using System.Linq;
using MonoGame.Extended.Collections;
using MonoGame.Extended.Content;
using Xunit;

namespace MonoGame.Extended.Tests.Content
{
    public class ContentReaderExtensionsTests
    {
        [Theory]
        [InlineData("testsuperdir/testsubdir1/testsubdir2/resource", "testsuperdir/testsubdir1/testsubdir2/resource")]
        [InlineData("testsuperdir/testsubdir1/../testsubdir2/resource","testsuperdir/testsubdir2/resource")]
        [InlineData("testsuperdir/../resource","resource")]
        [InlineData("../testsuperdir/testsubdir1/../testsubdir2/resource","../testsuperdir/testsubdir2/resource")]
        [InlineData("testsuperdir/testsubdir1/testsubdir2/../../testsubdir3/resource","testsuperdir/testsubdir3/resource")]
        [InlineData("testsuperdir/testsubdir1/../testsubdir2/../testsubdir3/resource", "testsuperdir/testsubdir3/resource")]
        public void ContentReaderExtensions_ShortenRelativePath(string input, string expectedoutput)
        {
            Assert.True(ContentReaderExtensions.ShortenRelativePath(input) == expectedoutput);
        }
    }
}