using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using FluentAssertions; using MontoyaTech.Rest.Net; using Xunit; namespace Rest.Net.Tests { public class ServeFileTests { public string TestDirectory = null; public string TestFile = null; public ServeFileTests() { this.TestDirectory = Path.Combine(Environment.CurrentDirectory, "test/"); if (!Directory.Exists(this.TestDirectory)) Directory.CreateDirectory(this.TestDirectory); this.TestFile = Path.Combine(this.TestDirectory, "test.html"); if (!File.Exists(this.TestFile)) File.WriteAllText(this.TestFile, "hello world"); } [Fact] public void ServeMultipleShouldWorkForFiles() { HttpListenerResponseExtensions.ResolveMultiPagePath(Path.Combine(Environment.CurrentDirectory, "test"), "../../test.html", null, out string resolvedPath, out bool isDirecotry).Should().BeTrue(); isDirecotry.Should().BeFalse(); resolvedPath.Should().BeEquivalentTo(this.TestFile); } } }