NewLife/X

引入redis服务,支持自动化单元测试
大石头 authored at 2022-03-31 22:56:30
171b4c9
Tree
1 Parent(s) 75e1011
Summary: 5 changed files with 10 additions and 18 deletions.
Modified +5 -0
Modified +1 -14
Modified +1 -1
Modified +2 -2
Modified +1 -1
Modified +5 -0
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 833c110..d007911 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -21,3 +21,8 @@ jobs:
       run: |
         dotnet build -c Release NewLife.Core/NewLife.Core.csproj
         dotnet build -c Release NewLife.Security/NewLife.Security.csproj
+    - name: Redis Server
+      uses: supercharge/redis-github-action@1.4.0
+    - name: Test
+      run: |
+        dotnet test -c Release XUnitTest.Core/XUnitTest.Core.csproj
Modified +1 -14
diff --git a/XUnitTest.Core/Caching/MemoryCacheTests.cs b/XUnitTest.Core/Caching/MemoryCacheTests.cs
index 7be4da2..0cccd69 100644
--- a/XUnitTest.Core/Caching/MemoryCacheTests.cs
+++ b/XUnitTest.Core/Caching/MemoryCacheTests.cs
@@ -14,14 +14,13 @@ using Xunit;
 
 namespace XUnitTest.Caching
 {
-    [TestCaseOrderer("NewLife.UnitTest.PriorityOrderer", "NewLife.UnitTest")]
+    [TestCaseOrderer("NewLife.UnitTest.DefaultOrderer", "NewLife.UnitTest")]
     public class MemoryCacheTests
     {
         public MemoryCache Cache { get; set; }
 
         public MemoryCacheTests() => Cache = new MemoryCache();
 
-        [TestOrder(0)]
         [Fact(DisplayName = "基础测试")]
         public void Test1()
         {
@@ -55,7 +54,6 @@ namespace XUnitTest.Caching
             Assert.True(ic.Count == 0);
         }
 
-        [TestOrder(2)]
         [Fact(DisplayName = "集合测试")]
         public void DictionaryTest()
         {
@@ -78,7 +76,6 @@ namespace XUnitTest.Caching
             }
         }
 
-        [TestOrder(4)]
         [Fact(DisplayName = "高级添加")]
         public void AddReplace()
         {
@@ -101,7 +98,6 @@ namespace XUnitTest.Caching
             Assert.NotEqual(Environment.UserName, name);
         }
 
-        [TestOrder(6)]
         [Fact]
         public void TryGet()
         {
@@ -126,7 +122,6 @@ namespace XUnitTest.Caching
             Assert.Equal(v1, v4);
         }
 
-        [TestOrder(8)]
         [Fact(DisplayName = "累加累减")]
         public void IncDec()
         {
@@ -147,7 +142,6 @@ namespace XUnitTest.Caching
             Assert.Equal(3.14 + 0.3, ic.Get<Double>("cc"));
         }
 
-        [TestOrder(10)]
         [Fact(DisplayName = "复杂对象")]
         public void TestObject()
         {
@@ -178,7 +172,6 @@ namespace XUnitTest.Caching
             public DateTime UpdateTime { get; set; }
         }
 
-        [TestOrder(20)]
         [Fact(DisplayName = "字节数组")]
         public void TestBuffer()
         {
@@ -194,7 +187,6 @@ namespace XUnitTest.Caching
             Assert.Equal(buf.ToHex(), buf2.ToHex());
         }
 
-        [TestOrder(30)]
         [Fact(DisplayName = "数据包")]
         public void TestPacket()
         {
@@ -210,7 +202,6 @@ namespace XUnitTest.Caching
             Assert.Equal(pk.ToHex(), pk2.ToHex());
         }
 
-        [TestOrder(80)]
         [Fact(DisplayName = "正常锁")]
         public void TestLock1()
         {
@@ -236,7 +227,6 @@ namespace XUnitTest.Caching
             Assert.False(ic.ContainsKey(k2.Key));
         }
 
-        [TestOrder(80)]
         [Fact(DisplayName = "抢锁失败")]
         public void TestLock2()
         {
@@ -264,7 +254,6 @@ namespace XUnitTest.Caching
             Assert.False(ic.ContainsKey("lock:TestLock2"));
         }
 
-        [TestOrder(80)]
         [Fact(DisplayName = "抢死锁")]
         public void TestLock3()
         {
@@ -292,7 +281,6 @@ namespace XUnitTest.Caching
             //Assert.True(sw.ElapsedMilliseconds <= 1000);
         }
 
-        [TestOrder(90)]
         [Theory]
         [InlineData(false)]
         [InlineData(true)]
@@ -325,7 +313,6 @@ namespace XUnitTest.Caching
             Assert.Equal("NewLife", ga.Name);
         }
 
-        [TestOrder(100)]
         [Theory]
         [InlineData(false)]
         [InlineData(true)]
Modified +1 -1
diff --git a/XUnitTest.Core/Configuration/HttpConfigProviderTests.cs b/XUnitTest.Core/Configuration/HttpConfigProviderTests.cs
index 43df6e9..0db92ad 100644
--- a/XUnitTest.Core/Configuration/HttpConfigProviderTests.cs
+++ b/XUnitTest.Core/Configuration/HttpConfigProviderTests.cs
@@ -89,7 +89,7 @@ namespace XUnitTest.Configuration
             {
                 Server = "http://star.newlifex.com:6600",
                 //Server = "http://localhost:6600",
-                AppId = "StarWeb"
+                AppId = "Test"
             };
 
             provider.Save(set);
Modified +2 -2
diff --git a/XUnitTest.Core/Remoting/ApiHttpClientTests.cs b/XUnitTest.Core/Remoting/ApiHttpClientTests.cs
index eaea858..11669e2 100644
--- a/XUnitTest.Core/Remoting/ApiHttpClientTests.cs
+++ b/XUnitTest.Core/Remoting/ApiHttpClientTests.cs
@@ -128,7 +128,7 @@ namespace XUnitTest.Remoting
         {
             var filter = new TokenHttpFilter
             {
-                UserName = "starweb",
+                UserName = "test",
                 Password = "",
             };
             var client = new ApiHttpClient("http://127.0.0.1:10001,http://127.0.0.1:20001,http://star.newlifex.com:6600")
@@ -236,7 +236,7 @@ namespace XUnitTest.Remoting
         {
             var filter = new TokenHttpFilter
             {
-                UserName = "starweb",
+                UserName = "test",
                 Password = "",
             };
 
Modified +1 -1
diff --git a/XUnitTest.Core/XUnitTest.Core.csproj b/XUnitTest.Core/XUnitTest.Core.csproj
index d8e35fd..d885d85 100644
--- a/XUnitTest.Core/XUnitTest.Core.csproj
+++ b/XUnitTest.Core/XUnitTest.Core.csproj
@@ -33,7 +33,7 @@
   <ItemGroup>
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
     <PackageReference Include="Moq" Version="4.17.2" />
-    <PackageReference Include="NewLife.UnitTest" Version="1.0.2022.320" />
+    <PackageReference Include="NewLife.UnitTest" Version="1.0.2022.324-beta0150" />
     <PackageReference Include="xunit" Version="2.4.1" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
       <PrivateAssets>all</PrivateAssets>