mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
add Unit test for Http.cs setting
This commit is contained in:
parent
cfbdf294bb
commit
f940e695a1
1 changed files with 33 additions and 0 deletions
33
Flow.Launcher.Test/HttpTest.cs
Normal file
33
Flow.Launcher.Test/HttpTest.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
|
using Flow.Launcher.Infrastructure.Http;
|
||||||
|
|
||||||
|
namespace Flow.Launcher.Test
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
class HttpTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestSettingUpdate()
|
||||||
|
{
|
||||||
|
HttpProxy proxy = new HttpProxy();
|
||||||
|
Http.Proxy = proxy;
|
||||||
|
|
||||||
|
proxy.Enabled = true;
|
||||||
|
proxy.Server = "127.0.0.1";
|
||||||
|
Assert.AreEqual(Http.WebProxy.Address, new Uri($"http://{proxy.Server}:{proxy.Port}"));
|
||||||
|
Assert.IsNull(Http.WebProxy.Credentials);
|
||||||
|
|
||||||
|
proxy.UserName = "test";
|
||||||
|
Assert.NotNull(Http.WebProxy.Credentials);
|
||||||
|
Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").UserName, proxy.UserName);
|
||||||
|
Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, "");
|
||||||
|
|
||||||
|
proxy.Password = "test password";
|
||||||
|
Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, proxy.Password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue