Skip to content

Commit

Permalink
暂存
Browse files Browse the repository at this point in the history
  • Loading branch information
姚正发 committed Oct 30, 2019
1 parent d08e5b2 commit a4ded82
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
7 changes: 6 additions & 1 deletion src/Sino.Nacos.Config/Net/ServerHttpAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public ServerHttpAgent(ConfigParam config, FastHttp http)
{
_config = config;
_http = http;
Init(config);
}

private void Init(ConfigParam config)
Expand All @@ -60,7 +61,7 @@ private void Init(ConfigParam config)
{
if (string.IsNullOrEmpty(config.Namespace))
{
_name = $"{FIXED_NAME}-{GetFixedNameSuffix(_serverList)}";
_name = $"{FIXED_NAME}-{GetFixedNameSuffix( )}";
}
else
{
Expand Down Expand Up @@ -98,6 +99,8 @@ private string GetFixedNameSuffix(IList<string> serverIps)
return sb.ToString();
}

#region 从特定节点获取Nacos服务器列表

/// <summary>
/// 只有当EndPoint填写后内部代码有效
/// </summary>
Expand Down Expand Up @@ -181,6 +184,8 @@ public async Task<IList<string>> GetServerListFromEndpoint()
return null;
}

#endregion

private Task<string> ReqApi(string api, Dictionary<string, string> headers, Dictionary<string, string> paramValue, HttpMethod httpMethod)
{
var snapshot = _serversFromEndpoint;
Expand Down
2 changes: 2 additions & 0 deletions test/NacosConfigUnitTest/NacosConfigUnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="RichardSzalay.MockHttp" Version="5.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
32 changes: 32 additions & 0 deletions test/NacosConfigUnitTest/ServerHttpAgentTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using RichardSzalay.MockHttp;
using Sino.Nacos.Config;
using System;
using Xunit;

namespace NacosConfigUnitTest
{
public class ServerHttpAgentTest
{
private ConfigParam _config;

private MockHttpMessageHandler _mockHttp;

public ServerHttpAgentTest()
{
_config = new ConfigParam
{

};

_mockHttp = new MockHttpMessageHandler();


}

[Fact]
public void Test1()
{

}
}
}
14 changes: 0 additions & 14 deletions test/NacosConfigUnitTest/UnitTest1.cs

This file was deleted.

0 comments on commit a4ded82

Please sign in to comment.