Example #1
0
        public void Can_do_VAT_check()
        {
            //remove? this method requires Internet access

            string    name, address;
            Exception exception;

            VatNumberStatus vatNumberStatus1 = _taxService.DoVatCheck("GB", "523 2392 69",
                                                                      out name, out address, out exception);

            if (exception != null && exception.Message == "MS_UNAVAILABLE")
            {
                throw new IgnoreException("Web Service Unavailable");
            }

            vatNumberStatus1.ShouldEqual(VatNumberStatus.Valid);
            exception.ShouldBeNull();

            VatNumberStatus vatNumberStatus2 = _taxService.DoVatCheck("GB", "000 0000 00",
                                                                      out name, out address, out exception);

            if (exception != null && exception.Message == "MS_UNAVAILABLE")
            {
                throw new IgnoreException("Web Service Unavailable");
            }

            vatNumberStatus2.ShouldEqual(VatNumberStatus.Invalid);
            exception.ShouldBeNull();
        }
Example #2
0
        public void Can_do_VAT_check()
        {
            Exception ex;

            // Check VAT of DB Vertrieb GmbH (Deutsche Bahn).
            VatNumberStatus vatNumberStatus1 = _taxService.DoVatCheck("DE", "814160246", out var _, out var _, out ex);

            ex.ShouldBeNull();
            vatNumberStatus1.ShouldEqual(VatNumberStatus.Valid);

            VatNumberStatus vatNumberStatus2 = _taxService.DoVatCheck("DE", "000000000", out var _, out var _, out ex);

            vatNumberStatus2.ShouldEqual(VatNumberStatus.Invalid);
            ex.ShouldBeNull();
        }
        public void Can_do_VAT_check()
        {
            //remove? this method requires Internet access

            var vatNumberStatus1 = _taxService.DoVatCheck("GB", "523 2392 69",
                                                          out string name, out string address, out Exception exception);

            vatNumberStatus1.ShouldEqual(VatNumberStatus.Valid);
            exception.ShouldBeNull();

            var vatNumberStatus2 = _taxService.DoVatCheck("GB", "000 0000 00",
                                                          out name, out address, out exception);

            vatNumberStatus2.ShouldEqual(VatNumberStatus.Invalid);
            exception.ShouldBeNull();
        }
        public void Can_do_VAT_check()
        {
            var vatNumberStatus1 = _taxService.DoVatCheck("GB", "523 2392 69",
                                                          out _, out _, out var exception);

            if (exception != null)
            {
                TestContext.WriteLine($"Can't run the \"Can_do_VAT_check\":\r\n{exception.Message}");
                return;
            }

            vatNumberStatus1.ShouldEqual(VatNumberStatus.Valid);

            var vatNumberStatus2 = _taxService.DoVatCheck("GB", "000 0000 00",
                                                          out _, out _, out exception);

            if (exception != null)
            {
                TestContext.WriteLine($"Can't run the \"Can_do_VAT_check\":\r\n{exception.Message}");
                return;
            }

            vatNumberStatus2.ShouldEqual(VatNumberStatus.Invalid);
        }
Example #5
0
 /// <summary>
 /// Performs a basic check of a VAT number for validity
 /// </summary>
 /// <param name="twoLetterIsoCode">Two letter ISO code of a country</param>
 /// <param name="vatNumber">VAT number</param>
 /// <param name="name">Company name</param>
 /// <param name="address">Address</param>
 /// <param name="exception">Exception</param>
 /// <returns>VAT number status</returns>
 public VatNumberStatus DoVatCheck(string twoLetterIsoCode, string vatNumber,
                                   out string name, out string address, out Exception exception)
 {
     return(_taxService.DoVatCheck(twoLetterIsoCode, vatNumber, out name, out address, out exception));
 }