View DumpDataTable.cs
private static void DumpDataTable(DataTable dt) | |
{ | |
if((dt == null) || (!SqlHelper.HasRows(dt))) | |
{ | |
Console.Error.WriteLine("There are no rows"); | |
} else | |
{ | |
foreach(DataColumn c in dt.Columns) | |
{ | |
Console.Write($"\"{c.ColumnName}\","); |
View SerializationHelper.cs
// using Microsoft.VisualStudio.TestTools.UnitTesting; | |
// using Newtonsoft.Json; | |
// using System; | |
// using System.Collections.Generic; | |
// using System.Linq; | |
/// <summary> | |
/// Tests that a model serializes correctly | |
/// </summary> | |
/// <typeparam name="T">Type</typeparam> |
View ElasticApmDemoController.cs
// NuGet: Elastic.Apm | |
using Blitzkrieg.ElasticApmHelper; | |
using Elastic.Apm.Api; | |
// ... | |
namespace Blitzkrieg.DemoWeb { | |
public class ValuesController : ApiController | |
{ | |
private Libs.ElasticWrapper alm = new ElasticWrapper(); |
View ElasticApmWrapper.cs
using System; | |
using Elastic.Apm.Api; | |
// NuGet: Elastic.Apm | |
namespace Blitzkrieg.ElasticApmHelper { | |
/// <summary> | |
/// Elastic Wrapper | |
/// </summary> | |
public class ElasticWrapper |
View TxTimer.cs
/// <summary> | |
/// Handy Helper to Time Executions of Tests | |
/// <example> | |
/// Here is a typical snippet, because the class supports <see cref="IDisposable"/> the time can be started at the top | |
/// of the using statement and automatically stopped in the dispose | |
/// <code> | |
/// // Stop Watch Created and Started | |
/// using (TxTimer myTimer = new TxTimer( ... )) { | |
/// // Do something you want timed | |
/// var elapsed = myTimer.ElapsedMilliseconds; |
View MsTestLogger.cs
/// <summary> | |
/// MsTestLogger<typeparamref name="T"/> for ILogger | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
public class MsTestLogger<T> : ILogger<T>, IDisposable | |
{ | |
private TestContext _output; | |
public MsTestLogger(TestContext output) | |
{ |
View AssertHelpers.cs
/// <summary> | |
/// Helpers to do asserts on objects in bulk | |
/// </summary> | |
public static class AssertHelpers | |
{ | |
#region "Serialization Helper" | |
/// <summary> | |
/// XUnit Tests that a model serializes correctly | |
/// </summary> |
View TestOutPutHelper.cs
/// <summary> | |
/// Helper to output as JSON | |
/// </summary> | |
public static class TestOutputHelper | |
{ | |
/// <summary> | |
/// Emit an object as json | |
/// </summary> | |
/// <param name="output">ITestOutputHelper</param> |
View SendMail.cs
using System.Net; | |
using System.Net.Mail; | |
namespace testemail | |
{ | |
public static class SendMailer | |
{ | |
public static void SendMail(EmailDTO dto) | |
{ | |
SmtpClient client = new SmtpClient(dto.address); |
View EMailDTO.cs
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace testemail | |
{ | |
public class EmailDTO | |
{ | |
public string address { get; set; } | |
public string port { get; set; } |