ExtensionMethodsTest.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using Xunit;
  3. using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
  4. namespace Masuit.Tools.UnitTest
  5. {
  6. [TestClass]
  7. public class ExtensionMethodsTest
  8. {
  9. [TestMethod]
  10. public void MatchUrl_True()
  11. {
  12. bool expect = "https://git.lug.us-tc.edu.cn/masuit/soft".MatchUrl();
  13. Assert.AreEqual(true, expect);
  14. }
  15. [TestMethod]
  16. public void MatchEmail()
  17. {
  18. bool expect = "[email protected]".MatchEmail();
  19. Assert.AreEqual(true, expect);
  20. }
  21. [TestMethod]
  22. public void MatchIdentifyCard_False()
  23. {
  24. bool expect = "513901199509120610".MatchIdentifyCard();
  25. Assert.AreEqual(false, expect);
  26. }
  27. [Theory]
  28. [InlineData("16666666666")]
  29. [InlineData("19999999999")]
  30. public void Can_MatchPhoneNumber_(string phone)
  31. {
  32. Xunit.Assert.True(phone.MatchPhoneNumber());
  33. }
  34. }
  35. }