Exemple #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));
        }
Exemple #2
0
        public async Task Endpoints_WebApi_CustomerSearchGet()
        {
            var url         = new ConfigurationManagerLocal().AppSettingValue("MyWebService");
            var request     = new HttpRequestGet <CustomerSearchModel>(url + "/CustomerSearch/-1/i/x/");
            var returnValue = await request.SendAsync();

            Assert.IsTrue(interfaceBreakingRelease || request.Response.IsSuccessStatusCode, request.Response.ReasonPhrase);
            Assert.IsTrue(interfaceBreakingRelease || returnValue.Results.Count > 0);
        }
Exemple #3
0
        public static void ClassInit(TestContext context)
        {
            // Database is required for these tests
            var databaseAccess = false;
            var configuration  = new ConfigurationManagerLocal();

            using (var connection = new SqlConnection(configuration.ConnectionStringValue("DefaultConnection")))
            {
                databaseAccess = connection.CanOpen();
            }
            Assert.IsTrue(databaseAccess);
        }
Exemple #4
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 void Data_ConnectionStringDatabase()
        {
            var result              = TypeExtension.DefaultString;
            var configManager       = new ConfigurationManagerLocal();
            var configConnectString = new ConnectionStringSafe();

            configConnectString = configManager.ConnectionString(this.GetAttributeValue <ConnectionStringName>(ConnectionStringName.DefaultConnectionName));
            result = configConnectString.ToEF(typeof(EntityWithConnectString));
            Assert.IsTrue(result != TypeExtension.DefaultString);
            Assert.IsTrue(configConnectString.IsValid);
            Assert.IsTrue(configConnectString.IsEF || configConnectString.IsADO);
            Assert.IsTrue(configConnectString.ConnectionStringType != ConnectionStringSafe.ConnectionStringTypes.Empty &&
                          configConnectString.ConnectionStringType != ConnectionStringSafe.ConnectionStringTypes.Invalid);
        }
        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);
        }
Exemple #7
0
        /// <summary>
        /// Loads config data
        /// </summary>
        /// <returns></returns>
        public async Task LoadDataAsync()
        {
            await Task.Delay(1);

            ConfigurationManager = new ConfigurationManagerLocal();
        }