-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit-tests have been ported to xUnit from old MSTest
- Loading branch information
Showing
26 changed files
with
805 additions
and
901 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,124 +1,123 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using net.r_eg.MvsSln.Core; | ||
using net.r_eg.MvsSln.Core; | ||
using Xunit; | ||
|
||
namespace net.r_eg.MvsSlnTest.Core | ||
namespace MvsSlnTest.Core | ||
{ | ||
[TestClass] | ||
public class ConfigItemTest | ||
{ | ||
[TestMethod] | ||
[Fact] | ||
public void EqTest1() | ||
{ | ||
ConfigItem target1 = new ConfigItem("Debug", "Any CPU"); | ||
|
||
Assert.AreEqual("Debug", target1.Configuration); | ||
Assert.AreEqual("Debug", target1.ConfigurationByRule); | ||
Assert.AreEqual("Any CPU", target1.Platform); | ||
Assert.AreEqual("AnyCPU", target1.PlatformByRule); | ||
Assert.Equal("Debug", target1.Configuration); | ||
Assert.Equal("Debug", target1.ConfigurationByRule); | ||
Assert.Equal("Any CPU", target1.Platform); | ||
Assert.Equal("AnyCPU", target1.PlatformByRule); | ||
|
||
|
||
Assert.AreEqual(target1, new ConfigItem("Debug", "Any CPU")); | ||
Assert.AreEqual(target1, new ConfigItem("Debug", "AnyCPU")); | ||
Assert.AreEqual(target1, new ConfigItem("deBUG", "anycpu")); | ||
Assert.AreNotEqual(target1, new ConfigItem("Release", "Any CPU")); | ||
Assert.AreNotEqual(target1, new ConfigItem("Debug", "Any CP")); | ||
Assert.Equal(target1, new ConfigItem("Debug", "Any CPU")); | ||
Assert.Equal(target1, new ConfigItem("Debug", "AnyCPU")); | ||
Assert.Equal(target1, new ConfigItem("deBUG", "anycpu")); | ||
Assert.NotEqual(target1, new ConfigItem("Release", "Any CPU")); | ||
Assert.NotEqual(target1, new ConfigItem("Debug", "Any CP")); | ||
} | ||
|
||
[TestMethod] | ||
[Fact] | ||
public void EqTest2() | ||
{ | ||
var target1 = new ConfigItem("Config1|Platform1"); | ||
|
||
Assert.AreEqual("Config1", target1.Configuration); | ||
Assert.AreEqual("Platform1", target1.Platform); | ||
Assert.Equal("Config1", target1.Configuration); | ||
Assert.Equal("Platform1", target1.Platform); | ||
|
||
var target2 = new ConfigItem(null); | ||
|
||
Assert.AreEqual(null, target2.Configuration); | ||
Assert.AreEqual(null, target2.ConfigurationByRule); | ||
Assert.AreEqual(null, target2.Platform); | ||
Assert.AreEqual(null, target2.PlatformByRule); | ||
Assert.Null(target2.Configuration); | ||
Assert.Null(target2.ConfigurationByRule); | ||
Assert.Null(target2.Platform); | ||
Assert.Null(target2.PlatformByRule); | ||
|
||
var target3 = new ConfigItem("Config1", "Platform1"); | ||
Assert.AreEqual("Config1|Platform1", target3.ToString()); | ||
Assert.AreEqual("Config1|Platform1", target3.Format()); | ||
Assert.Equal("Config1|Platform1", target3.ToString()); | ||
Assert.Equal("Config1|Platform1", target3.Format()); | ||
} | ||
|
||
[TestMethod] | ||
[Fact] | ||
public void EqRuleTest1() | ||
{ | ||
var target = new ConfigItem("Debug", "Any CPU"); | ||
|
||
Assert.AreEqual("Debug", target.Configuration); | ||
Assert.AreEqual("Debug", target.ConfigurationByRule); | ||
Assert.AreEqual("Any CPU", target.Platform); | ||
Assert.AreEqual("AnyCPU", target.PlatformByRule); | ||
Assert.Equal("Debug", target.Configuration); | ||
Assert.Equal("Debug", target.ConfigurationByRule); | ||
Assert.Equal("Any CPU", target.Platform); | ||
Assert.Equal("AnyCPU", target.PlatformByRule); | ||
} | ||
|
||
[TestMethod] | ||
[Fact] | ||
public void EqRuleTest2() | ||
{ | ||
Assert.AreEqual(new ConfigItem("Debug", "Platform1"), new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = true }); | ||
Assert.AreEqual(new ConfigItem("Debug", "Platform1") { SensitivityComparing = true }, new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = true }); | ||
Assert.Equal(new ConfigItem("Debug", "Platform1"), new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = true }); | ||
Assert.Equal(new ConfigItem("Debug", "Platform1") { SensitivityComparing = true }, new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = true }); | ||
|
||
Assert.AreNotEqual(new ConfigItem("Debug", "Platform1"), new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = false }); | ||
Assert.AreNotEqual(new ConfigItem("Debug", "Platform1") { SensitivityComparing = false }, new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = false }); | ||
Assert.AreNotEqual(new ConfigItem("Debug", "Platform1") { SensitivityComparing = false }, new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = true }); | ||
Assert.NotEqual(new ConfigItem("Debug", "Platform1"), new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = false }); | ||
Assert.NotEqual(new ConfigItem("Debug", "Platform1") { SensitivityComparing = false }, new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = false }); | ||
Assert.NotEqual(new ConfigItem("Debug", "Platform1") { SensitivityComparing = false }, new ConfigItem("deBUG", "platFORM1") { SensitivityComparing = true }); | ||
} | ||
|
||
[TestMethod] | ||
[Fact] | ||
public void IsEqualByRuleTest1() | ||
{ | ||
var target = new ConfigItem("Debug", "Any CPU"); | ||
|
||
Assert.AreEqual(true, target.IsEqualByRule("Debug", "Any CPU", false)); | ||
Assert.AreEqual(false, target.IsEqualByRule("debug", "Any CPU", false)); | ||
Assert.True(target.IsEqualByRule("Debug", "Any CPU", false)); | ||
Assert.False(target.IsEqualByRule("debug", "Any CPU", false)); | ||
|
||
Assert.AreEqual(true, target.IsEqualByRule("Debug", "AnyCPU", false)); | ||
Assert.AreEqual(false, target.IsEqualByRule("Debug", "Anycpu", false)); | ||
Assert.True(target.IsEqualByRule("Debug", "AnyCPU", false)); | ||
Assert.False(target.IsEqualByRule("Debug", "Anycpu", false)); | ||
|
||
Assert.AreEqual(true, target.IsEqualByRule("Debug", "Anycpu", true)); | ||
Assert.True(target.IsEqualByRule("Debug", "Anycpu", true)); | ||
|
||
Assert.AreEqual(false, target.IsEqualByRule(null, null, false)); | ||
Assert.AreEqual(false, target.IsEqualByRule(null, null, true)); | ||
Assert.False(target.IsEqualByRule(null, null, false)); | ||
Assert.False(target.IsEqualByRule(null, null, true)); | ||
} | ||
|
||
[TestMethod] | ||
[Fact] | ||
public void NoPlatformTest1() | ||
{ | ||
var target = new ConfigItem("Config"); | ||
|
||
Assert.AreEqual("Config", target.Configuration); | ||
Assert.AreEqual(string.Empty, target.Platform); | ||
Assert.Equal("Config", target.Configuration); | ||
Assert.Equal(string.Empty, target.Platform); | ||
|
||
target = new ConfigItem("Config|"); | ||
|
||
Assert.AreEqual("Config", target.Configuration); | ||
Assert.AreEqual(string.Empty, target.Platform); | ||
Assert.Equal("Config", target.Configuration); | ||
Assert.Equal(string.Empty, target.Platform); | ||
|
||
target = new ConfigItem("Config| "); | ||
|
||
Assert.AreEqual("Config", target.Configuration); | ||
Assert.AreEqual(" ", target.Platform); | ||
Assert.Equal("Config", target.Configuration); | ||
Assert.Equal(" ", target.Platform); | ||
} | ||
|
||
[TestMethod] | ||
[Fact] | ||
public void CtorTest1() | ||
{ | ||
var target = new ConfigItem(""); | ||
|
||
Assert.AreEqual(string.Empty, target.Configuration); | ||
Assert.AreEqual(string.Empty, target.Platform); | ||
Assert.Equal(string.Empty, target.Configuration); | ||
Assert.Equal(string.Empty, target.Platform); | ||
|
||
target = new ConfigItem(" "); | ||
|
||
Assert.AreEqual(" ", target.Configuration); | ||
Assert.AreEqual(string.Empty, target.Platform); | ||
Assert.Equal(" ", target.Configuration); | ||
Assert.Equal(string.Empty, target.Platform); | ||
|
||
target = new ConfigItem(null); | ||
|
||
Assert.AreEqual(null, target.Configuration); | ||
Assert.AreEqual(null, target.Platform); | ||
Assert.Null(target.Configuration); | ||
Assert.Null(target.Platform); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.