-
-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor IfEnvEmptySetDefault to a static method
- Loading branch information
agile.zhou
committed
Sep 8, 2024
1 parent
9287c2c
commit 7eee7d9
Showing
10 changed files
with
99 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
test/AgileConfig.Server.ServiceTests/ISettingServiceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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); | ||
} | ||
} | ||
} |