public ChinaRailwayApp(ulong id, string key, string gateway_url) { this.app_id = id; { var data_serializer = new DataSerializer(new JsonSerializerSettings() { DateFormatString = "yyyy-MM-dd HH:mm:ss.fff", NullValueHandling = NullValueHandling.Ignore, ContractResolver = new Smartunicom.Runtime.Serialization.ContractResolver.JsonSnakeCasePropertyNamesContractResolver() }); var data_signer = new RS256(); data_signer.SetPrivateKey(key); var data_signer_all = new DataSignature(data_signer, data_verifier, data_hs256); { this.order_task = new ChargeTask(this.app_id, data_serializer, data_signer_all, gateway_url); this.payment_task = new PayTask(this.app_id, data_serializer, data_signer_all, gateway_url); this.transfer_task = new TransferTask(this.app_id, data_serializer, data_signer_all, gateway_url); this.webhook_task = new WebHookTask(this.app_id, data_serializer, data_signer_all, gateway_url); this.serializer = new Serializer(data_serializer); } } }
public void TestDischargeTask() { //Arrange Init(); var chargeTask = new ChargeTask(_phone, StubShowBattery) { IsTestDischarge = true, TestIterations = 40, DischargeInterval = 0 }; //Act chargeTask.DischargingTask.Wait(); //TearDown chargeTask.StopDischarge(); //Assert Assert.AreEqual(_phone.BatteryBase.Charge, 50); }