Example #1
0
        public void TwoPathSegmentsIncludeFileAndOneParentDirectory()
        {
            // Arrange

            var service = new FilePathService();

            // Act

            var path = service.ReducePath(@"C:\Three\Two\One.txt", 2);

            // Assert

            Assert.That(path, Is.EqualTo(@"Two\One.txt"));
        }
Example #2
0
        public void OnePathSegmentIncludesFileOnly()
        {
            // Arrange

            var service = new FilePathService();

            // Act

            var path = service.ReducePath(@"C:\Three\Two\One.txt", 1);

            // Assert

            Assert.That(path, Is.EqualTo(@"One.txt"));
        }
Example #3
0
        public void FullNameIsReturnedIfPathSegmentCountIsGreaterThanSegmentsInFullName()
        {
            // Arrange

            const string fullName = @"C:\Three\Two\One.txt";

            var service = new FilePathService();

            // Act

            var path = service.ReducePath(fullName, 9);

            // Assert

            Assert.That(path, Is.EqualTo(fullName));
        }