Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Scott Sauber scottsauber

:shipit:
View GitHub Profile
View Something.js
const firstArray = [ 1, 2, 3]; // Prettier will still format this line with its defaults
// prettier-ignore
const secondArray = [
4,
5,
6
];
const somethingElse = 'blah';
View RegisterAccountService.cs
using MailKit.Net.Smtp;
using MimeKit;
using MimeKit.Text;
using RazorHtmlEmails.RazorClassLib.Services;
using RazorHtmlEmails.RazorClassLib.Views.Emails.ConfirmAccount;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace RazorHtmlEmails.Common
View CalculatorServiceTests.cs
[Fact]
public void AddShouldSumNumbers()
{
var result = CalculatorService.Add(1, 1);
result.Should().Be(3);
}
View CalculatorServiceTests.cs
[Fact]
public void AddShouldSumNumbers()
{
var result = CalculatorService.Add(1, 1);
Assert.Equal(3, result);
}
View CalculatorServiceTests.cs
[Fact]
public void AddShouldSumNumbers()
{
var result = CalculatorService.Add(1, 1);
Assert.True(result == 3);
}
View AdministratorPages.cs
// Pages constants class
public class AdministratorPages
{
public const string Base = "/Administrator";
public static string Index = $"{Base}/Index";
public static string EmployeesIndex = $"{Base}/Employees/Index";
}
// Usage in a View
<a asp-page="@AdministratorPages.Index">Administrator Home Page</a>
View WorkerService.csproj
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
View CounterTests.cs
public class CounterTests : TestContext
{
[Fact]
public void ShouldIncrementCountWhenButtonIsClicked()
{
var counterComponent = RenderComponent<Counter>();
counterComponent.Find("button").Click();
// Asserts actual user behavior