Ejemplo n.º 1
0
        public void UpdateInvoiceTest()
        {
            string invoiceNumber = "1236545";

            Identifier identifier = new Identifier
            {
                Email     = "*****@*****.**",
                Reference = "Refernce"
            };
            Link linkSelf       = new Link("Href1", "title", "Method");
            Link paymentMethods = new Link("Href2", "paymethodstitle", "paymethods");
            Link address        = new Link("Href3", "addresstitle", "address");

            CustomerLinks customerLinks = new CustomerLinks(linkSelf, paymentMethods, address);
            Customer      customer      = new Customer("1813221695", "customer description", identifier, customerLinks);

            LineItem        lineItem  = new LineItem("1", "Name", "Desc", 2, "4", true);
            List <LineItem> lineITems = new List <LineItem>();

            lineITems.Add(lineItem);

            Tax    tax           = new Tax(1, "tax", 2, "taxt");
            string authorization = "Basic asdadsa";

            mockRestClient.Expects.One.Method(v => v.Execute(new RestRequest())).With(NMock.Is.TypeOf(typeof(RestRequest))).WillReturn(invoiceResponse);
            ApiClient apiClient = new ApiClient(mockRestClient.MockObject);

            apiClient.Configuration = null;

            Configuration configuration = new Configuration
            {
                ApiClient      = apiClient,
                Username       = "******",
                Password       = "******",
                AccessToken    = null,
                ApiKey         = null,
                ApiKeyPrefix   = null,
                TempFolderPath = null,
                DateTimeFormat = null,
                Timeout        = 60000,
                UserAgent      = "asdasd"
            };

            instance = new InvoicesApi(configuration);
            UpdateInvoice updateInvoice = new UpdateInvoice("update invoice ", customer, "Test", "50", 10, 2, 12, 75, lineITems, tax);
            var           response      = instance.UpdateInvoice(invoiceNumber, updateInvoice, authorization);

            Assert.IsInstanceOf <Invoice>(response, "response is Invoice");
        }