From ac769e656b122ff569c3f1534701b71e00fed586 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 27 Oct 2020 19:21:35 +0800 Subject: Split front and back end. --- Timeline.Tests/ErrorCodeTest.cs | 53 ----------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 Timeline.Tests/ErrorCodeTest.cs (limited to 'Timeline.Tests/ErrorCodeTest.cs') diff --git a/Timeline.Tests/ErrorCodeTest.cs b/Timeline.Tests/ErrorCodeTest.cs deleted file mode 100644 index 258ebf4e..00000000 --- a/Timeline.Tests/ErrorCodeTest.cs +++ /dev/null @@ -1,53 +0,0 @@ -using FluentAssertions; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Timeline.Models.Http; -using Xunit; -using Xunit.Abstractions; - -namespace Timeline.Tests -{ - public class ErrorCodeTest - { - private readonly ITestOutputHelper _output; - - public ErrorCodeTest(ITestOutputHelper output) - { - _output = output; - } - - [Fact] - public void ShouldWork() - { - var errorCodes = new Dictionary(); - - void RecursiveCheckErrorCode(Type type) - { - foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) - .Where(fi => fi.IsLiteral && !fi.IsInitOnly && fi.FieldType == typeof(int))) - { - var name = type.FullName + "." + field.Name; - var value = (int)field.GetRawConstantValue(); - _output.WriteLine($"Find error code {name} , value is {value}."); - - value.Should().BeInRange(1000_0000, 9999_9999, "Error code should have exactly 8 digits."); - - errorCodes.Should().NotContainKey(value, - "identical error codes are found and conflict paths are {0} and {1}", - name, errorCodes.GetValueOrDefault(value)); - - errorCodes.Add(value, name); - } - - foreach (var nestedType in type.GetNestedTypes()) - { - RecursiveCheckErrorCode(nestedType); - } - } - - RecursiveCheckErrorCode(typeof(ErrorCodes)); - } - } -} -- cgit v1.2.3