public void AddOrReplaceExtensionWorks() { var pb = new VirtualPathBuilder().CombineWith("~/t.cs"); Assert.IsTrue(pb.GetExtension() == "cs"); pb.AddOrReplaceExtension("vb"); Assert.IsTrue(pb.GetExtension() == "vb"); pb.Clear().CombineWith("foo"); Assert.IsFalse(pb.HasExtension()); pb.AddOrReplaceExtension("vb"); Assert.IsTrue(pb.GetExtension() == "vb"); }
public void GetExtensionWorks() { var pb = new VirtualPathBuilder().CombineWith("."); Assert.IsTrue(pb == "."); Assert.IsFalse(pb.HasExtension()); Assert.IsNull(pb.GetExtension()); pb.Clear().CombineWith("~/oops.cshtml"); Assert.IsTrue(pb.HasExtension()); pb.Normalize(); Assert.IsTrue(pb.HasExtension()); Assert.IsTrue(pb.GetExtension() == "cshtml"); Assert.IsTrue(pb.HasExtension()); Assert.IsTrue(pb.GetExtension(true) == "cshtml"); Assert.IsFalse(pb.HasExtension()); }
public void RemoveExtensionWorks() { var pb = new VirtualPathBuilder(); pb.RemoveExtension(); pb.CombineWith("oops.cs"); Assert.IsTrue(pb.GetExtension() == "cs"); pb.RemoveExtension(); Assert.IsNull(pb.GetExtension()); }