You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
37 lines
1.3 KiB
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Senparc.CO2NET.Extensions;
|
|
using Senparc.Weixin.TenPayV3.Apis.Entities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Senparc.Weixin.TenPayV3.Test.net7.Apis.Entities
|
|
{
|
|
[TestClass]
|
|
public class TenPayApiResultCodeTests
|
|
{
|
|
[TestMethod]
|
|
public void TryGetCodeTest()
|
|
{
|
|
var result = TenPayApiResultCode.TryGetCode(System.Net.HttpStatusCode.BadRequest, "{\"code\":\"RESOURCE_ALREADY_EXISTS\",\"message\":\"创建请求重入,但本次请求与上次请求信息不一致\"}");
|
|
Assert.IsNotNull(result);
|
|
Assert.AreEqual("400", result.StateCode);
|
|
Assert.IsFalse(result.Success);
|
|
Assert.AreEqual("RESOURCE_ALREADY_EXISTS", result.ErrorCode);
|
|
Assert.AreEqual("创建请求重入,但本次请求与上次请求信息不一致", result.Solution);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TryGetCode_204Test()
|
|
{
|
|
var result = TenPayApiResultCode.TryGetCode(System.Net.HttpStatusCode.NoContent, null);
|
|
Assert.IsNotNull(result);
|
|
Console.WriteLine(result.ToJson(true));
|
|
Assert.AreEqual("204", result.StateCode);
|
|
Assert.IsTrue(result.Success);
|
|
}
|
|
}
|
|
}
|