Skip to content

Instantly share code, notes, and snippets.

{
"scripts": [],
"styles": []
}
@ssa3512
ssa3512 / codeswing.json
Last active December 2, 2021 14:42
test
{
"scripts": [],
"styles": []
}
@ssa3512
ssa3512 / LogCheckExtensions.cs
Created March 21, 2021 00:55 — forked from MelbourneDeveloper/LogCheckExtensions.cs
ILogger Verification with Moq
using Microsoft.Extensions.Logging;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
// More detailed samples here:
// https://github.com/MelbourneDeveloper/RestClient.Net/blob/79cca66e02f83a1043c44f215d374139f40f8c12/src/RestClient.Net.UnitTests/UnitTests.cs#L758
@ssa3512
ssa3512 / delegating.cs
Created December 11, 2020 00:57
Delegating Handler share underlying Handler with DI
async Task Main()
{
await NoDi();
await WithDi();
}
async Task NoDi()
{
var handler = new TestHttpClientHandler()
{
@ssa3512
ssa3512 / tasks.cs
Last active July 31, 2020 14:48
Tasks
async Task Example1()
{
Task<SomeType1> task1 = DoSomethingAsync1();
Task<SomeType2> task2 = DoSomethingAsync2();
await Task.WhenAll(task1, task2);
SomeType1 result1 = task1.Result; // Should never use .Result in async methods?
SomeType2 result2 = task2.Result; // Should never use .Result in async methods?
@ssa3512
ssa3512 / StaticInit.cs
Created June 16, 2020 20:45
.NET Core lazy static properties
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace StaticInitTest
{
[TestClass]
public class UnitTest1
{
#if !NETCOREAPP
[ExpectedException(typeof(TypeInitializationException))]
@ssa3512
ssa3512 / Vertex.Native.targets
Created May 9, 2020 21:49
Vertex.Native.targets
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<!-- Win x64 -->
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\cb65.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Link>native-x64\cb65.dll</Link>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libexpat.dll">
@ssa3512
ssa3512 / index.html
Last active February 17, 2020 19:44
react-1
<div id="app">
</div>
@ssa3512
ssa3512 / throw1.cs
Last active January 8, 2020 19:37
.NET stack preservation
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
try
{
@ssa3512
ssa3512 / codeswing.json
Last active December 2, 2021 14:43
webplayground1
‎‎​