using Explorer.Application; namespace Explorer.Application.Tests; public class TreeRevealSelectorTests { private static readonly TreeRevealCandidate Drive = new(@"D:\", false); private static readonly TreeRevealCandidate Photos = new(@"D:\Photos", true); private static readonly TreeRevealCandidate HomeDocs = new(@"C:\Users\Dominique\Documents", false); private static readonly TreeRevealCandidate FavDocs = new(@"C:\Users\Dominique\Documents", true); [Fact] public void This_pc_context_does_not_jump_to_a_matching_favorite() { var chosen = TreeRevealSelector.Choose( [Photos, Drive], @"D:\Photos\Vacation", preferFavorites: false, currentlyInFavorites: false); Assert.Equal(Drive, chosen); } [Fact] public void Favorite_context_stays_in_the_favorite() { var chosen = TreeRevealSelector.Choose( [Photos, Drive], @"D:\Photos\Vacation", preferFavorites: false, currentlyInFavorites: true); Assert.Equal(Photos, chosen); } [Fact] public void Leaving_a_favorite_falls_back_to_the_drive() { var chosen = TreeRevealSelector.Choose( [Photos, Drive], @"D:\Other", preferFavorites: false, currentlyInFavorites: true); Assert.Equal(Drive, chosen); } [Fact] public void Prefer_favorites_selects_the_pin_from_this_pc() { var chosen = TreeRevealSelector.Choose( [Photos, Drive], @"D:\Photos\Vacation", preferFavorites: true, currentlyInFavorites: false); Assert.Equal(Photos, chosen); } [Fact] public void Home_beats_the_drive_when_favorites_are_not_preferred() { var chosen = TreeRevealSelector.Choose( [FavDocs, HomeDocs, new(@"C:\", false)], @"C:\Users\Dominique\Documents\Work", preferFavorites: false, currentlyInFavorites: false); Assert.Equal(HomeDocs, chosen); } [Fact] public void Prefer_favorites_selects_the_documents_pin_over_home() { var chosen = TreeRevealSelector.Choose( [FavDocs, HomeDocs, new(@"C:\", false)], @"C:\Users\Dominique\Documents\Work", preferFavorites: true, currentlyInFavorites: false); Assert.Equal(FavDocs, chosen); } }