private void btnGetWeigh_Click(object sender, EventArgs e) { PackageInfo packageInfo = new PackageInfo("Plain"); SamWeightAdapter handler = new SamWeightAdapter(); this.weight = handler.GetWeight(); txtWeigh.Text = this.weight.ToString() + " ounces"; }
public void ProcessTest() { ShippingDetailInfo input = new ShippingDetailInfo(); input.PackageInfo = PackageInfoFactory.GetLetterPackageInstance("Plain"); input.DeliveryMethod = DeliveryMethodEnum.Ground; input.OriginAddress = new AddressInfo("John Doe", "Happy Street", "KL", "Selangor", "56000"); input.DestinationAddress = new AddressInfo("Jane Doe", "Sad Street", "KL", "Selangor", "56000"); SamWeightAdapter target = new SamWeightAdapter(); double actual; Assert.IsTrue(input.PackageInfo.Weight == 0); actual = target.GetWeight(); Assert.IsTrue(actual > 0); }