Example #1
0
        public async Task Endpoints_WebApi_CustomerPost()
        {
            var responseData = new CustomerModel();
            var urlCustomer  = new ConfigurationManagerLocal().AppSettingValue("MyWebService").AddLast("/Customer");

            await this.Endpoints_WebApi_CustomerPut();

            var keyToGet = WebApiEndpointsTests.RecycleBin.Count() > 0 ? WebApiEndpointsTests.RecycleBin[0] : TypeExtension.DefaultGuid;

            var url        = new Uri(urlCustomer.AddLast("/") + keyToGet.ToStringSafe());
            var requestGet = new HttpRequestGet <CustomerModel>(url);

            responseData = await requestGet.SendAsync();

            Assert.IsTrue(interfaceBreakingRelease || !responseData.IsNew);

            var testKey = RandomString.Next();

            responseData.FirstName = responseData.FirstName.AddLast(testKey);
            var request = new HttpRequestPost <CustomerModel>(urlCustomer.TryParseUri(), responseData);

            responseData = await request.SendAsync();

            Assert.IsTrue(interfaceBreakingRelease || !responseData.IsNew);
            Assert.IsTrue(interfaceBreakingRelease || responseData.FirstName.Contains(testKey));
        }
Example #2
0
        public async Task Endpoints_WebApi_CustomerGet()
        {
            var urlCustomer = new ConfigurationManagerLocal().AppSettingValue("MyWebService").AddLast("/Customer");

            await this.Endpoints_WebApi_CustomerPut();

            var keyToGet = (WebApiEndpointsTests.RecycleBin.Count() > 0 ? WebApiEndpointsTests.RecycleBin[0] : TypeExtension.DefaultGuid).ToString();
            var request  = new HttpRequestGet <CustomerModel>(urlCustomer.AddLast("/") + keyToGet.ToString());

            var responseData = await request.SendAsync();

            Assert.IsTrue(interfaceBreakingRelease || !responseData.IsNew);
        }
        public async Task Endpoints_Framework_WebAPI_CustomerDelete()
        {
            var responseData = new CustomerModel();
            var urlCustomer  = new ConfigurationManagerLocal().AppSettingValue("MyWebService").AddLast("/Customer");

            await this.Endpoints_Framework_WebAPI_CustomerPut();

            var keyToDelete = Endpoints_Framework_for_WebApi.RecycleBin.Count() > 0 ? Endpoints_Framework_for_WebApi.RecycleBin[0] : TypeExtension.DefaultGuid;

            var requestDelete = new HttpRequestDelete(urlCustomer.AddLast("/") + keyToDelete.ToString());
            await requestDelete.SendAsync();

            Assert.IsTrue(interfaceBreakingRelease || requestDelete.Response.IsSuccessStatusCode);

            var requestGet = new HttpRequestGet <CustomerModel>(urlCustomer);

            responseData = await requestGet.SendAsync();

            Assert.IsTrue(interfaceBreakingRelease || responseData.IsNew);
        }