mirror of
https://github.com/dotnetcore/AgileConfig.git
synced 2026-10-18 21:21:12 +08:00
52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using AgileConfig.Server.IService;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace AgileConfig.Server.ServiceTests
|
|
{
|
|
[TestClass]
|
|
public class ISettingServiceTests
|
|
{
|
|
[TestMethod]
|
|
public void IfEnvEmptySetDefaultTest()
|
|
{
|
|
// Arrange
|
|
string env = "test";
|
|
ISettingService.EnvironmentList = new string[] { "test", "prod" };
|
|
|
|
// Act
|
|
ISettingService.IfEnvEmptySetDefault(ref env);
|
|
|
|
// Assert
|
|
Assert.AreEqual("test", env);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void IfEnvEmptySetDefault_envEmpty_shouldReturn_defaul()
|
|
{
|
|
// Arrange
|
|
string env = "";
|
|
ISettingService.EnvironmentList = new string[] { "test", "prod" };
|
|
|
|
// Act
|
|
ISettingService.IfEnvEmptySetDefault(ref env);
|
|
|
|
// Assert
|
|
Assert.AreEqual("test", env);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void IfEnvEmptySetDefault_envNull_shouldReturn_defaul()
|
|
{
|
|
// Arrange
|
|
string env = null;
|
|
ISettingService.EnvironmentList = new string[] { "test", "prod" };
|
|
|
|
// Act
|
|
ISettingService.IfEnvEmptySetDefault(ref env);
|
|
|
|
// Assert
|
|
Assert.AreEqual("test", env);
|
|
}
|
|
}
|
|
}
|