Mike Horvath photo from week before Christmas 2024:
I am sure not many really missed my website, but for those who did; I am back and plan on continuing with no further stoppages until the Lord calls me home.
Every word you give me is a miracle word— how could I help but obey? Break open your words, let the light shine out, let ordinary people see the meaning. Mouth open and panting, I wanted your commands more than anything. Turn my way, look kindly on me, as you always do to those who personally love you. Steady my steps with your Word of promise so nothing malign gets the better of me. Rescue me from the grip of bad men and women so I can live life your way. Smile on me, your servant; teach me the right way to live. I cry rivers of tears because nobody’s living by your book!
You may have already downloaded our nuget package and want some additional assistance in getting started using HSS_API_Store_SDK. Below you will find a unit test code snippet that demonstrates calls to the methods provided in our nuget package. Be sure to scroll through the entire post there is more after the following code.
using HSS_API_Store_SDK;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Configuration;
using System.Threading.Tasks;
using static HSS_API_Store_SDK.apiResponsePasswords;
using static HSS_API_Store_SDK.apiResponseFoods;
using static HSS_API_Store_SDK.apiResponsePeople;
namespace HSS_API_Store_SDK_UnitTests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public async Task TestMethod1()
{
var apiResponse = await Passwords.GetPasswordsAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_PasswordsKey"), 10, 20, 8, "", true, RequiredSymbols.Digits);
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.passwordValues);
Assert.AreEqual(ResponseEnumPasswords.Success, apiResponse.responseStatus);
Assert.AreEqual(9, apiResponse.passwordValues.GetUpperBound(0));
foreach(var password in apiResponse.passwordValues)
{
Console.WriteLine(password);
}
}
[TestMethod]
public async Task TestMethod2()
{
var apiResponse = await Passwords.GetPasswordsAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_PasswordsKey"), PasswordCharacterSelection: RequiredSymbols.Digits);
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.passwordValues);
Assert.AreEqual(ResponseEnumPasswords.Success, apiResponse.responseStatus);
Assert.AreEqual(0, apiResponse.passwordValues.GetUpperBound(0));
foreach (var password in apiResponse.passwordValues)
{
Console.WriteLine(password);
}
}
[TestMethod]
public async Task TestMethod3()
{
var apiResponse = await Foods.GetFoodsAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_FoodsKey"));
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.foodsList);
Assert.AreEqual(ResponseEnumFoods.Success, apiResponse.responseStatus);
Assert.AreEqual(0, apiResponse.foodsList.ToArray().GetUpperBound(0));
foreach (var food in apiResponse.foodsList)
{
Console.WriteLine(food.foodInformation.Name);
}
}
[TestMethod]
public async Task TestMethod4()
{
var apiResponse = await Foods.GetFoodsAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_FoodsKey"), 20, "goat's milk");
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.foodsList);
Assert.AreEqual(ResponseEnumFoods.Success, apiResponse.responseStatus);
Assert.AreEqual(19, apiResponse.foodsList.ToArray().GetUpperBound(0));
foreach (var food in apiResponse.foodsList)
{
Console.WriteLine(food.foodInformation.BrandName + " " + food.foodInformation.Name + " " + food.foodInformation.HouseholdServing);
Console.WriteLine(food.foodInformation.Ingredients);
Console.WriteLine(" ");
}
}
[TestMethod]
public async Task TestMethod5()
{
var apiResponse = await People.GetPeopleAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_PeopleKey"), 5, StateSelection: StateIDEnum.AR);
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.peopleList);
Assert.AreEqual(ResponseEnumPeople.Success, apiResponse.responseStatus);
Assert.AreEqual(4, apiResponse.peopleList.ToArray().GetUpperBound(0));
foreach (var person in apiResponse.peopleList)
{
Console.WriteLine(person.Prefix + " " + person.FirstName + " " + person.LastName);
Console.WriteLine(person.AddressLine1);
if (person.AddressLine2 != null && person.AddressLine2 != "")
Console.WriteLine(person.AddressLine2);
Console.WriteLine(person.City + ", " + person.StateID + " " + person.ZipCode);
Console.WriteLine(person.PhoneNumber.FormatPhoneNumber());
Console.WriteLine(" ");
}
}
}
}
using HSS_API_Store_SDK;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Configuration;
using System.Threading.Tasks;
using static HSS_API_Store_SDK.apiResponsePasswords;
using static HSS_API_Store_SDK.apiResponseFoods;
using static HSS_API_Store_SDK.apiResponsePeople;
namespace HSS_API_Store_SDK_UnitTests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public async Task TestMethod1()
{
var apiResponse = await Passwords.GetPasswordsAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_PasswordsKey"), 10, 20, 8, "", true, RequiredSymbols.Digits);
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.passwordValues);
Assert.AreEqual(ResponseEnumPasswords.Success, apiResponse.responseStatus);
Assert.AreEqual(9, apiResponse.passwordValues.GetUpperBound(0));
foreach(var password in apiResponse.passwordValues)
{
Console.WriteLine(password);
}
}
[TestMethod]
public async Task TestMethod2()
{
var apiResponse = await Passwords.GetPasswordsAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_PasswordsKey"), PasswordCharacterSelection: RequiredSymbols.Digits);
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.passwordValues);
Assert.AreEqual(ResponseEnumPasswords.Success, apiResponse.responseStatus);
Assert.AreEqual(0, apiResponse.passwordValues.GetUpperBound(0));
foreach (var password in apiResponse.passwordValues)
{
Console.WriteLine(password);
}
}
[TestMethod]
public async Task TestMethod3()
{
var apiResponse = await Foods.GetFoodsAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_FoodsKey"));
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.foodsList);
Assert.AreEqual(ResponseEnumFoods.Success, apiResponse.responseStatus);
Assert.AreEqual(0, apiResponse.foodsList.ToArray().GetUpperBound(0));
foreach (var food in apiResponse.foodsList)
{
Console.WriteLine(food.foodInformation.Name);
}
}
[TestMethod]
public async Task TestMethod4()
{
var apiResponse = await Foods.GetFoodsAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_FoodsKey"), 20, "goat's milk");
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.foodsList);
Assert.AreEqual(ResponseEnumFoods.Success, apiResponse.responseStatus);
Assert.AreEqual(19, apiResponse.foodsList.ToArray().GetUpperBound(0));
foreach (var food in apiResponse.foodsList)
{
Console.WriteLine(food.foodInformation.BrandName + " " + food.foodInformation.Name + " " + food.foodInformation.HouseholdServing);
Console.WriteLine(food.foodInformation.Ingredients);
Console.WriteLine(" ");
}
}
[TestMethod]
public async Task TestMethod5()
{
var apiResponse = await People.GetPeopleAsync(ConfigurationManager.AppSettings.Get("HSS_API_Store_EmailAddress"),
ConfigurationManager.AppSettings.Get("HSS_API_Store_PeopleKey"), 5, StateSelection: StateIDEnum.AR);
Assert.IsNotNull(apiResponse);
Assert.IsNotNull(apiResponse.peopleList);
Assert.AreEqual(ResponseEnumPeople.Success, apiResponse.responseStatus);
Assert.AreEqual(4, apiResponse.peopleList.ToArray().GetUpperBound(0));
foreach (var person in apiResponse.peopleList)
{
Console.WriteLine(person.Prefix + " " + person.FirstName + " " + person.LastName);
Console.WriteLine(person.AddressLine1);
if (person.AddressLine2 != null && person.AddressLine2 != "")
Console.WriteLine(person.AddressLine2);
Console.WriteLine(person.City + ", " + person.StateID + " " + person.ZipCode);
Console.WriteLine(person.PhoneNumber.FormatPhoneNumber());
Console.WriteLine(" ");
}
}
}
}
You will need to setup an app.config file in your project if you want to build this unit test code to define the AppSettings used in the code. Below is a sample app.config with placeholders in curly braces for your email and API keys. You can change these to the values you received when you requested API keys from our API Store.
We have been working on .Net Web APIs that provide functionality that you may incorporate into your own application. As of this posting we have three APIs available: 1) GetFoodsAPI, 2) PasswordGeneratorAPI and 3) PeopleGeneratorAPI.
The get foods API will return records from the USDA Food Database used in our Food Allergy Checker. You may pass your criterion to the API to search the database for foods matching the criterion. We limit the result set to top {Count} parameter setting which allows values from 1 to 20.
The password generator can be used in a number of ways. Some examples are to generate access keys for your applications, to generate passwords to login to your various accounts, and more...
The people generator will generate random fictional people information that is useful for test automation where you need to test an application with fictitious people. This API is configurable to let you select the state you want the people to be located in. The addresses are made up randomly but do use actual city names and zip codes for more realistic data. The phone numbers are appropriate for the area code of the city the people are located in. The API could for example be consumed from a Selenium test automation using your code to call the API. We will work on examples of using this API to aid you in your development of these. Please check back later for future posts on the topic.
We hope you find these to be useful and look for future APIs to appear on the store site. Thanks for reading about our efforts and have a blessed day!
We make use of a script on our server that hosts our websites to encrypt our web.config and perform various other deployment tasks. For some time we have logged into the server to run this script after publishing our websites from Visual Studio. After doing this for a while we had the idea that Visual Studio should be able to execute our script once the website publish task is completed. We were using File System publish to deploy our website. Long story short, we failed to get the script to execute when our publish task completes. It turns out that this is not supported for File System publish.
After getting some rest from our attempts at implementing this, we decided to give it another try. This time we carefully read what we found from Google searches and found that web deploy of website does support execution of a script after publish completes. Here is what we learned: add the following to your .csproj file for the web application in Visual Studio just before the </Project> tag.
The Exec Command may be any command you wish to use. In our case we execute a batch file script that makes a call to Power Shell to execute another script on our server that performs the tasks we need to complete deployment of the website.
We hope this saves you from duplicating our mistakes while developing this solution. Have a blessed day!