mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using NUnit.Framework;
|
|
using System;
|
|
using Flow.Launcher.Infrastructure.UserSettings;
|
|
using Flow.Launcher.Infrastructure.Http;
|
|
using NUnit.Framework.Legacy;
|
|
|
|
namespace Flow.Launcher.Test
|
|
{
|
|
[TestFixture]
|
|
class HttpTest
|
|
{
|
|
[Test]
|
|
public void GivenHttpProxy_WhenUpdated_ThenWebProxyShouldAlsoBeUpdatedToTheSame()
|
|
{
|
|
HttpProxy proxy = new HttpProxy();
|
|
Http.Proxy = proxy;
|
|
|
|
proxy.Enabled = true;
|
|
proxy.Server = "127.0.0.1";
|
|
ClassicAssert.AreEqual(Http.WebProxy.Address, new Uri($"http://{proxy.Server}:{proxy.Port}"));
|
|
ClassicAssert.IsNull(Http.WebProxy.Credentials);
|
|
|
|
proxy.UserName = "test";
|
|
ClassicAssert.NotNull(Http.WebProxy.Credentials);
|
|
ClassicAssert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").UserName, proxy.UserName);
|
|
ClassicAssert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, "");
|
|
|
|
proxy.Password = "test password";
|
|
ClassicAssert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, proxy.Password);
|
|
}
|
|
}
|
|
}
|