public void ElderSignVerifyTrue() { var req = new HexSalesIF_Service.model.VoucherTransactionNewReq(0, "*821832590011746224", "503024", "2", "0", "2018-09-22 18:05:42", "0", "546", "", "18092262242100035290", 0, "B3B2AD70145CDAABED03EA05B9088C77"); IConfigReader mockConfigReader = Mock.Of <IConfigReader>(i => i.GetAppSetting("singKey", "") == "ABCD1234"); //mock配置 var watchDog = new HexSalesIF_Service.ElderWebReqeustWatchDog(mockConfigReader); //初始化老验证看门狗 var valid = watchDog.VerifySign(req.ToStringDictionary(true), "B3B2AD70145CDAABED03EA05B9088C77"); //验证 Assert.IsTrue(valid); }
public void NewSignVerifyTrue() { var req = new HexSalesIF_Service.model.VoucherTransactionNewReq(1, "401532740000000501", "600017", "1234", "234", "2018-09-14", "20", "1", "123", "334", 14, "hZ1wPz6XesDebwpMHvotRBea4Uw8RKSoFcl1uSdyd5nuFaCTWU9UDPHLtwMlUiAnL5hJX0fvVuqhNrEqcklv+FDC4fdmIY++VeQXalpBab+ogd/5DKsZtXOoax8uhzhMbftOucNOgReCB0rHu+QPWAJCOXLtjDAPxjVsZjZooAqSjhgeaAGKGoN4uNVQpfDg/wxhAucmA93O/5GNY7wvstjFvWhU2fF3QkQNglzUYgEmu99EDEZcT7ZfG7wtS06fCfgsNzfwWQa2JF8t98xjVhO41xQbikqng8/SWgDjHJ3Pgv0D2E2bOE6wv3jVxAZW0j6X33KSiPJMPuFuw4zwQg=="); var mockConfigReader = new Mock <IConfigReader>(); //mock配置 mockConfigReader.Setup(m => m.GetAppSetting("SecretKeyDictName", "sk")).Returns("sk"); mockConfigReader.Setup(m => m.GetAppSetting("PublicKeyFlieName", "CustomPublicKey.xml")).Returns("CustomPublicKey.xml"); mockConfigReader.Setup(m => m.GetAppSetting("PrivateKeyFlieName", "VendorPrivateKey.xml")).Returns("VendorPrivateKey.xml"); var watchDog = new HexSalesIF_Service.NewWebRequestWatchDog(mockConfigReader.Object); //初始化新验证看门狗 // 验证 var valid = watchDog.VerifySign(req.ToStringDictionary(true), "hZ1wPz6XesDebwpMHvotRBea4Uw8RKSoFcl1uSdyd5nuFaCTWU9UDPHLtwMlUiAnL5hJX0fvVuqhNrEqcklv+FDC4fdmIY++VeQXalpBab+ogd/5DKsZtXOoax8uhzhMbftOucNOgReCB0rHu+QPWAJCOXLtjDAPxjVsZjZooAqSjhgeaAGKGoN4uNVQpfDg/wxhAucmA93O/5GNY7wvstjFvWhU2fF3QkQNglzUYgEmu99EDEZcT7ZfG7wtS06fCfgsNzfwWQa2JF8t98xjVhO41xQbikqng8/SWgDjHJ3Pgv0D2E2bOE6wv3jVxAZW0j6X33KSiPJMPuFuw4zwQg=="); Assert.IsTrue(valid); }