Skip to content

Instantly share code, notes, and snippets.

View AndyWatt83's full-sized avatar

Andy Watt AndyWatt83

View GitHub Profile
@AndyWatt83
AndyWatt83 / tasks.json
Last active August 3, 2018 23:43
tasks.json file to enable running the test commmand for C# development tutorial
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceRoot}/src/CSharpWithVSCode.ConsoleApp/CSharpWithVSCode.ConsoleApp.csproj"
using Prism.Mef;
using System.ComponentModel.Composition.Hosting;
using System.Windows;
namespace WireFrame.Shell
{
class Bootstrapper : MefBootstrapper
{
protected override DependencyObject CreateShell()
{
using System.Windows;
namespace TaskList.Shell
{
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var bootstrapper = new Bootstrapper();
<Window x:Class="WireFrame.Shell.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WireFrame.Shell"
mc:Ignorable="d"
Title="Shell" Height="450" Width="600">
<Window.Resources>
<Thickness x:Key="BtnMargin">5,5,5,0</Thickness>
pragma solidity ^0.4.18;
import "./ConvertLib.sol";
// This is just a simple example of a coin-like contract.
// It is not standards compatible and cannot be expected to talk to other
// coin/token contracts. If you want to create a standards-compliant
// token, see: https://github.com/ConsenSys/Tokens. Cheers!
contract MetaCoin {
@AndyWatt83
AndyWatt83 / truffleTestHelper.js
Created July 21, 2018 23:53
A helper file with a couple of functions for advancing the blockchain in time, and blocks.
advanceTimeAndBlock = async (time) => {
await advanceTime(time);
await advanceBlock();
return Promise.resolve(web3.eth.getBlock('latest'));
}
advanceTime = (time) => {
return new Promise((resolve, reject) => {
web3.currentProvider.sendAsync({
@AndyWatt83
AndyWatt83 / truffleTestHelperExamples.js
Last active November 26, 2020 15:46
Shows how the evm_mine, and evm_increaseTime helper wrappers are used in an actual test.
const helper = require("./helpers/truffleTestHelper");
describe("Testing Helper Functions", () => {
it("should advance the blockchain forward a block", async () =>{
const originalBlockHash = web3.eth.getBlock('latest').hash;
let newBlockHash = web3.eth.getBlock('latest').hash;
newBlockHash = await helper.advanceBlock();
assert.notEqual(originalBlockHash, newBlockHash);
<Project>
<Target Name="VSTestIfTestProject">
<CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" />
</Target>
</Project>
<Project>
<Target Name="VSTest">
<MSBuild Projects="@(ProjectReference)" Targets="VSTestIfTestProject" />
</Target>
</Project>
@AndyWatt83
AndyWatt83 / MigrationsTest.cs
Last active December 1, 2021 23:37
Unit testing entity framework migrations
using Dapper;
using FluentAssertions;
using Npgsql;
using System;
using Xunit;
namespace SampleDatabase.Test
{
[TestCaseOrderer("TestingEntityFramework.MigrationTestOrderer", "TestingEntityFramework")]
public class MigrationsTest : IClassFixture<MigratingDatabaseFixture>