Exemple #1
0
        public void CreateSiteAsync_PassObject_ShouldNotThrowException()
        {
            var testJob = new NewSite()
            {
                Name                  = ("AVIA TECHNIQUE LTD"),
                Phone                 = (""),
                Postcode              = ("RG41 2QJ"),
                Region                = ("UNITED KINGDOM"),
                AccountNumber         = (null),
                AccountNumber2        = (null),
                Address1              = ("UNIT 3 FISHPONDS ESTATE"),
                Address2              = ("FISHPONDS ROAD"),
                Address3              = ("WOKINGHAM"),
                AutoEmail             = (false),
                City                  = ("BERKSHIRE"),
                Contact               = (""),
                Coordinate            = null,
                Country               = ("GB"),
                Customer              = (1286862),
                Email                 = (""),
                EtaEmailNotifications = (null),
                EtaSmsNotifications   = (null)
            };

            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var result = Task.Run(async() => await client.CreateSiteAsync(testJob).ConfigureAwait(false)).Result;

            result.Id.Should().BeGreaterThan(0);
        }
Exemple #2
0
        public void GetSitesAsync_PassId_ReturnObject()
        {
            var customerId = 1286862;
            var client     = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var sites = Task.Run(async() => await client.GetSitesAsync(customerId).ConfigureAwait(false)).Result;
            var site  = sites.FirstOrDefault(e => e.Id == 3943512);

            site.Name.Should().Be("AVIA TECHNIQUE LTD");
            site.Phone.Should().Be("");
            site.Postcode.Should().Be("");
            site.Region.Should().Be("UNITED KINGDOM");
            site.AccountNumber.Should().Be(null);
            site.AccountNumber2.Should().Be(null);
            site.Active.Should().Be(true);
            site.Address1.Should().Be("UNIT 3 FISHPONDS ESTATE");
            site.Address2.Should().Be("FISHPONDS ROAD");
            site.Address3.Should().Be("WOKINGHAM");
            site.AutoEmail.Should().Be(false);
            site.City.Should().Be("BERKSHIRE RG41 2QJ");
            site.Contact.Should().Be("");
            site.Coordinate.Latitude.Should().Be(null);
            site.Coordinate.Longitude.Should().Be(null);
            site.Country.Should().Be("GB");
            site.Customer.Should().Be(1286862);
            site.Email.Should().Be("");
            site.EtaEmailNotifications.Should().Be(null);
            site.EtaSmsNotifications.Should().Be(null);
        }
Exemple #3
0
        public void CreateJobAsyncDateTrunc_PassObject_ShouldNotThrowException()
        {
            var testJob = new NewJob()
            {
                Customer      = 13364055, // WIND ROSE AVIATION COMPANY LTD
                Depot         = 39645,    // Test Depot
                Site          = 66090015, // WIND ROSE AVIATION COMPANY LTD
                Instructions1 = "Integration Test Please Ignore",
                Template      = 1594,     // AJW DELIVERY ORDER
                DueBy         = DateTime.Parse("2021-01-10T12:00:00"),
                Items         = new List <NewJobItemsData>(),
                Fields        = new Dictionary <string, string>()
            };

            testJob.Fields.Add("Despatch Note Number", "TestValue");

            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var result = Task.Run(async() => await client.CreateJobAsync(testJob).ConfigureAwait(false)).Result;

            result.Job.Job.Id.Should().BeGreaterThan(0);
            result.JobFields.JobFieldsData.FirstOrDefault().Name.Should().Be("Despatch Note Number");
            result.JobFields.JobFieldsData.FirstOrDefault().Value.Should().Be("TestValue");

            var deleteResult = Task.Run(async() => await client.DeleteJobAsync(result.Job.Job.Id).ConfigureAwait(false)).Result;

            deleteResult.Should().BeTrue();
        }
Exemple #4
0
        public void CreateCustomerAsync_PassNothing_ReturnObjects()
        {
            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var newCustomer = new NewCustomer();

            newCustomer.Address1  = "Exchange House";
            newCustomer.Address2  = "54-58 Athol Street";
            newCustomer.Address3  = "";
            newCustomer.AutoEmail = false;
            newCustomer.City      = "Douglas";
            newCustomer.Country   = "GB";
            newCustomer.Email     = null;
            newCustomer.Name      = "DOTNOUSE-UNITTEST";
            newCustomer.Phone     = null;
            newCustomer.Postcode  = "IM1 1JD";
            newCustomer.Region    = null;

            var result = Task.Run(async() => await client.CreateCustomerAsync(newCustomer).ConfigureAwait(false)).Result;

            result.Id.Should().BeGreaterThan(0);
            result.Address1.Should().Be(newCustomer.Address1);
            result.Address2.Should().Be(newCustomer.Address2);
            result.Address3.Should().Be(newCustomer.Address3);
            result.AutoEmail.Should().Be(newCustomer.AutoEmail);
            result.City.Should().Be(newCustomer.City);
            result.Country.Should().Be(newCustomer.Country);
            result.Email.Should().Be(newCustomer.Email);
            result.Name.Should().Be(newCustomer.Name);
            result.Phone.Should().Be(newCustomer.Phone);
            result.Postcode.Should().Be(newCustomer.Postcode);
            result.Region.Should().Be(newCustomer.Region);
        }
Exemple #5
0
        public void GetAccountAsync_PassUrlSecret_ReturnObject()
        {
            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var account = Task.Run(async() => await client.GetAccountAsync().ConfigureAwait(false)).Result;

            account.Address1.Should().Be("The Headquarters");
        }
Exemple #6
0
        public void GetPodsAsync_PassUrlSecret_ReturnObject()
        {
            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var account = Task.Run(async() => await client.GetPodsAsync(DateTime.Parse("2020-09-20T00:00:00Z"), DateTime.Parse("2020-09-20T23:59:00Z")).ConfigureAwait(false)).Result;

            account.FirstOrDefault().Id.Should().BeGreaterThan(0);
        }
Exemple #7
0
        public void GetCustomersAsync_PassNothing_ReturnObjects()
        {
            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var results = Task.Run(async() => await client.GetCustomersAsync().ConfigureAwait(false)).Result;

            results.Count().Should().BeGreaterThan(0);
        }
Exemple #8
0
        public void GetJobAsync_PassJobId_ReturnObject()
        {
            var jobId  = 2769052;
            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var job = Task.Run(async() => await client.GetJobAsync(jobId).ConfigureAwait(false)).Result;

            job.Id.Should().Be(jobId);
        }
Exemple #9
0
        public void GetPodsPdfAsync_PassUrlSecret_ReturnObject()
        {
            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var pods       = Task.Run(async() => await client.GetPodsAsync(DateTime.Parse("2020-09-20T00:00:00Z"), DateTime.Parse("2020-09-20T23:59:00Z")).ConfigureAwait(false)).Result;
            var cosmeticId = pods.FirstOrDefault(e => e.CosmeticId > 0).CosmeticId;
            var pdf        = Task.Run(async() => await client.GetPodsPdfAsync(cosmeticId).ConfigureAwait(false)).Result;

            pdf.GetBytes().Length.Should().BeGreaterThan(0);
        }
Exemple #10
0
        public void GetPodByJobIdAsync_PassUrlSecret_ReturnObject()
        {
            var jobId         = 501646735;
            var expectedPodId = 271804675;

            var client = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());
            var pod = Task.Run(async() => await client.GetPodByJobIdAsync(jobId, DateTime.Parse("2020-09-20T00:00:00Z"), DateTime.Parse("2020-09-20T23:59:00Z")).ConfigureAwait(false)).Result;

            pod.Job.Should().Be(jobId);
            pod.CosmeticId.Should().BeGreaterThan(0);
            pod.Id.Should().Be(expectedPodId);
        }
Exemple #11
0
        public void GetCustomerAsync_PassId_ReturnObject()
        {
            var customerId = 727065;
            var client     = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var result = Task.Run(async() => await client.GetCustomerAsync(customerId).ConfigureAwait(false)).Result;

            result.Id.Should().Be(customerId);
            result.Address1.Should().Be("Exchange House");
            result.Address2.Should().Be("54-58 Athol Street");
            result.Address3.Should().Be("");
            result.AutoEmail.Should().Be(false);
            result.City.Should().Be("Douglas IM1 1JD");
            result.Country.Should().Be("GB");
            result.Email.Should().Be(null);
            result.Name.Should().Be("A J WALTER LEASING LTD");
            result.Phone.Should().Be(null);
            result.Postcode.Should().Be("");
            result.Region.Should().Be(null);
        }
Exemple #12
0
        public void GetCustomersAsync_PassName_ReturnObjectsContaining()
        {
            var customerName = "A J WALTER LEASING LTD";
            var client       = new PodfatherClientV1(GetAPIKey());

            client.SetLogger(GetLogger());

            var results = Task.Run(async() => await client.GetCustomersAsync(0, customerName).ConfigureAwait(false)).Result;
            var result  = results.FirstOrDefault(e => e.Id == 727065);

            result.Id.Should().Be(727065);
            result.Address1.Should().Be("Exchange House");
            result.Address2.Should().Be("54-58 Athol Street");
            result.Address3.Should().Be("");
            result.AutoEmail.Should().Be(false);
            result.City.Should().Be("Douglas IM1 1JD");
            result.Country.Should().Be("GB");
            result.Email.Should().Be(null);
            result.Name.Should().Be("A J WALTER LEASING LTD");
            result.Phone.Should().Be(null);
            result.Postcode.Should().Be("");
            result.Region.Should().Be(null);
        }