public async Task ReturnsBadRequestWhenGivenInvalidCompactFilterValue()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/compact/hsdg");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsBadRequestWhenAddingProductIdWhichIsAlreadyExisting()
        {
            var setter  = new ClientSetUp();
            var product = new Product()
            {
                ProductId               = "CM",
                ProductName             = "Mock Product 2",
                Description             = "This product is being added for testing purposes",
                Price                   = "10000",
                Compact                 = "true",
                Portability             = "true",
                SafeToFlyCertification  = "true",
                CyberSecurity           = "true",
                MultiPatientSupport     = "true",
                SoftwareUpdateSupport   = "true",
                ProductSpecificTraining = "false",
                ThirdPartyDeviceSupport = "false",
                BatterySupport          = "true",
                TouchScreenSupport      = "true"
            };

            var content  = setter.CreateProductContent(product);
            var response = await setter.Client.PostAsync("api/productsdatabase/products", content);

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsBadRequestForGettingProductWithNonExistingId()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productsdatabase/products/XYZ");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsOkWhenProductIsUpdated()
        {
            var setter  = new ClientSetUp();
            var product = new Product()
            {
                ProductId   = "X3",
                ProductName = "Mock Product",
                Description = "This product is being added for testing purposes",
                Price       = "100",
                Compact     = "true",
                Portability = "false",

                SafeToFlyCertification  = "true",
                CyberSecurity           = "true",
                MultiPatientSupport     = "false",
                SoftwareUpdateSupport   = "false",
                ProductSpecificTraining = "true",
                ThirdPartyDeviceSupport = "false",
                BatterySupport          = "false",
                TouchScreenSupport      = "false"
            };

            var content  = setter.CreateProductContent(product);
            var response = await setter.Client.PutAsync("api/productsdatabase/products/X3", content);

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task ReturnsBadRequestWhenGivenPriceAsInvalidValueFilter()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/price/xyz/above");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsBadRequestWhenDeletingInvalidProductId()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.DeleteAsync("api/productsdatabase/products/ZZZ");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsBadRequestForInvalidProductId()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/XYZ");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsBadRequestWhenCyberSecurityFilterValueIsCorrupted()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/cybersecurity/jdsk");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsBadRequestWhenMultiPatientSupportFilterValueIsCorrupted()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/multipatientsupport/jdsk");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsBadRequestWhenThirdPartyDeviceSupportFilterValueIsCorrupted()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/thirdpartydevicesupport/jdsk");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task ReturnsBadRequestWhenProductSpecificTrainingFilterValueIsCorrupted()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/productspecifictraining/ajsdk");

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
예제 #12
0
        public async Task CheckStatusCodeEqualOkGetAllProducts()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/alert/alerts");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task ReturnsProductListWhenGivenSoftwareUpdateSupportFilter()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/softwareupdatesupport/false");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task ReturnsProductListWhenGivenMultiPatientSupportFilter()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/multipatientsupport/true");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task ReturnsProductListWhenGivenAbovePriceFilter()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/price/15000/above");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task CheckStatusCodeEqualOkGetProductById()
        {
            ClientSetUp setter   = new ClientSetUp();
            var         response = await setter.Client.GetAsync("api/productsdatabase/products/X3");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task ReturnsProductListWhenGivenCyberSecurityFilter()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/cybersecurity/true");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task ReturnsProductListWhenGivenProductSpecificTrainingFilter()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/productspecifictraining/false");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task ReturnsProductListWhenGivenSafeToFlyFilter()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.GetAsync("api/productfilters/filters/safetofly/false");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task ReturnsOkAfterDeletingAValidProductRecord()
        {
            var setter   = new ClientSetUp();
            var response = await setter.Client.DeleteAsync("api/productsdatabase/products/AB");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
예제 #21
0
        public async Task ReturnsBadRequestStatusCodeWhenAFieldIsNull()
        {
            var setter = new ClientSetUp();
            var alert  = new CustomerAlert()
            {
                CustomerName    = null,
                CustomerEmailId = "*****@*****.**",
                ProductId       = "AB",
                PhoneNumber     = "7874393847"
            };

            var content = setter.CreateAlertContent(alert);
            await setter.SendInvalidPostRequest(content);
        }
예제 #22
0
        public async Task ReturnsOkStatusCodeWhenAlertIsAdded()
        {
            var setter = new ClientSetUp();
            var alert  = new CustomerAlert()
            {
                CustomerName    = "Venkat",
                CustomerEmailId = "*****@*****.**",
                ProductId       = "X3",
                PhoneNumber     = "7874393847"
            };

            var content  = setter.CreateAlertContent(alert);
            var response = await setter.Client.PostAsync("api/alert/alerts", content);

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }