コード例 #1
0
        public void TestScan(string scanValues)
        {
            try
            {
                var proxy = new CheckoutClient();

                proxy.Scan(scanValues);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #2
0
ファイル: UnsuccessfulTests.cs プロジェクト: cj2978/Checkout2
        public void TestCalculateSingleSKUTotalPrice(string scanValues, string invalidValue)
        {
            try
            {
                var proxy = new CheckoutClient();

                proxy.Scan(scanValues);

                proxy.GetTotalPrice();

                throw new Exception("Error was expected, however no error thrown");
            }
            catch (Exception e)
            {
                var expectedError = string.Format("The SKU {0} is not a valid value", invalidValue);

                if (e.Message != expectedError)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }
        }
コード例 #3
0
        public void TestCalculateSingleSKUTotalPrice(string scanValues, int expectedResult)
        {
            try
            {
                var proxy = new CheckoutClient();

                proxy.Scan(scanValues);

                var result = proxy.GetTotalPrice();

                if (result != expectedResult)
                {
                    var error = string.Format(
                        "For the input of {0}, the expected the value of {1} should be returned. Returned values from the service was {2}", scanValues, expectedResult, result);

                    throw new Exception(error);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }