Skip to content

Commit da59599

Browse files
taoocerosjjw24
authored andcommitted
add Unit test for Http.cs setting
1 parent a1e8577 commit da59599

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Flow.Launcher.Test/HttpTest.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using NUnit.Framework;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
using Flow.Launcher.Infrastructure.UserSettings;
6+
using Flow.Launcher.Infrastructure.Http;
7+
8+
namespace Flow.Launcher.Test
9+
{
10+
[TestFixture]
11+
class HttpTest
12+
{
13+
[Test]
14+
public void TestSettingUpdate()
15+
{
16+
HttpProxy proxy = new HttpProxy();
17+
Http.Proxy = proxy;
18+
19+
proxy.Enabled = true;
20+
proxy.Server = "127.0.0.1";
21+
Assert.AreEqual(Http.WebProxy.Address, new Uri($"http://{proxy.Server}:{proxy.Port}"));
22+
Assert.IsNull(Http.WebProxy.Credentials);
23+
24+
proxy.UserName = "test";
25+
Assert.NotNull(Http.WebProxy.Credentials);
26+
Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").UserName, proxy.UserName);
27+
Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, "");
28+
29+
proxy.Password = "test password";
30+
Assert.AreEqual(Http.WebProxy.Credentials.GetCredential(Http.WebProxy.Address, "Basic").Password, proxy.Password);
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)