PageRenderTime 39ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/yoyo/CardInChinaNew/CardInChina.Test/MySqlFunctionsTest.cs

#
C# | 105 lines | 47 code | 13 blank | 45 comment | 3 complexity | 96bd63dbcc508ff0c1b2ca801a523687 MD5 | raw file
Possible License(s): LGPL-3.0, Apache-2.0, LGPL-2.1, BSD-3-Clause
  1. using System.Linq;
  2. using CardInChina.Data.Entity;
  3. using Microsoft.VisualStudio.TestTools.UnitTesting;
  4. using System;
  5. using CardInChina.Data.Entity.Entity;
  6. using System.Data.Objects.SqlClient;
  7. using System.Data.Objects;
  8. namespace CardInChina.Test
  9. {
  10. /// <summary>
  11. ///This is a test class for MySqlFunctionsTest and is intended
  12. ///to contain all MySqlFunctionsTest Unit Tests
  13. ///</summary>
  14. [TestClass()]
  15. public class MySqlFunctionsTest
  16. {
  17. private TestContext testContextInstance;
  18. /// <summary>
  19. ///Gets or sets the test context which provides
  20. ///information about and functionality for the current test run.
  21. ///</summary>
  22. public TestContext TestContext
  23. {
  24. get
  25. {
  26. return testContextInstance;
  27. }
  28. set
  29. {
  30. testContextInstance = value;
  31. }
  32. }
  33. #region Additional test attributes
  34. //
  35. //You can use the following additional attributes as you write your tests:
  36. //
  37. //Use ClassInitialize to run code before running the first test in the class
  38. //[ClassInitialize()]
  39. //public static void MyClassInitialize(TestContext testContext)
  40. //{
  41. //}
  42. //
  43. //Use ClassCleanup to run code after all tests in a class have run
  44. //[ClassCleanup()]
  45. //public static void MyClassCleanup()
  46. //{
  47. //}
  48. //
  49. //Use TestInitialize to run code before running each test
  50. //[TestInitialize()]
  51. //public void MyTestInitialize()
  52. //{
  53. //}
  54. //
  55. //Use TestCleanup to run code after each test has run
  56. //[TestCleanup()]
  57. //public void MyTestCleanup()
  58. //{
  59. //}
  60. //
  61. #endregion
  62. /// <summary>
  63. ///A test for OldPassword
  64. ///</summary>
  65. [TestMethod()]
  66. public void OldPasswordTest()
  67. {
  68. using (var db = new CICEntities())
  69. {
  70. // var cc = db.Customers.FirstOrDefault(p => p.Account == "77是" && p.Password == MySqlFunctions.OldPassword("User@123"));
  71. var cc = db.Customers.Where(p => p.Account == "77是" && p.Password == MySqlFunctions.OldPassword("User@123"));
  72. //var cc = db.Customers.Where(p => p.Account == "77是" );
  73. var n = cc.Count();
  74. //var ss = db.CardInfoes.Where(p => p.CardName == "网易一卡通");
  75. //var n = ss.Count();
  76. }
  77. }
  78. /// <summary>
  79. ///A test for MD5
  80. ///</summary>
  81. [TestMethod()]
  82. public void MD5Test()
  83. {
  84. string data = "326.61"; // TODO: Initialize to an appropriate value
  85. string expected = "498bf4f69e2136fe82d5fedc599a1bd4"; // TODO: Initialize to an appropriate value
  86. string actual;
  87. actual = MySqlFunctions.MD5(data);
  88. Assert.AreEqual(expected, actual);
  89. Assert.Inconclusive("Verify the correctness of this test method.");
  90. }
  91. }
  92. }