mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-24 01:35:07 +01:00
* Update examples (#158) * IIS debug * PathBase logic * 1.0.4.5-preview-01 * Fix project and readme * Fix issues * fix picture alignment * Add IIS publish examples * 1.0.4.5
54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
using System;
|
|
using Microsoft.Owin;
|
|
using NFluent;
|
|
using WireMock.Util;
|
|
using Xunit;
|
|
|
|
namespace WireMock.Net.Tests.Util
|
|
{
|
|
public class UrlUtilsTests
|
|
{
|
|
[Fact]
|
|
public void UriUtils_CreateUri_WithValidPathString()
|
|
{
|
|
// Assign
|
|
Uri uri = new Uri("https://localhost:1234/a/b?x=0");
|
|
|
|
// Act
|
|
var result = UrlUtils.Parse(uri, new PathString("/a"));
|
|
|
|
// Assert
|
|
Check.That(result.Url.ToString()).Equals("https://localhost:1234/b?x=0");
|
|
Check.That(result.AbsoluteUrl.ToString()).Equals("https://localhost:1234/a/b?x=0");
|
|
}
|
|
|
|
[Fact]
|
|
public void UriUtils_CreateUri_WithEmptyPathString()
|
|
{
|
|
// Assign
|
|
Uri uri = new Uri("https://localhost:1234/a/b?x=0");
|
|
|
|
// Act
|
|
var result = UrlUtils.Parse(uri, new PathString());
|
|
|
|
// Assert
|
|
Check.That(result.Url.ToString()).Equals("https://localhost:1234/a/b?x=0");
|
|
Check.That(result.AbsoluteUrl.ToString()).Equals("https://localhost:1234/a/b?x=0");
|
|
}
|
|
|
|
[Fact]
|
|
public void UriUtils_CreateUri_WithDifferentPathString()
|
|
{
|
|
// Assign
|
|
Uri uri = new Uri("https://localhost:1234/a/b?x=0");
|
|
|
|
// Act
|
|
var result = UrlUtils.Parse(uri, new PathString("/test"));
|
|
|
|
// Assert
|
|
Check.That(result.Url.ToString()).Equals("https://localhost:1234/a/b?x=0");
|
|
Check.That(result.AbsoluteUrl.ToString()).Equals("https://localhost:1234/a/b?x=0");
|
|
}
|
|
}
|
|
}
|