Skip to content

Instantly share code, notes, and snippets.

@JamesBender
JamesBender / cancellable-wait.js
Created January 20, 2017 19:01 — forked from ericelliott/cancellable-wait.js
Cancellable wait -- an ES6 promise example
const wait = (
time,
cancel = Promise.reject()
) => new Promise((resolve, reject) => {
const timer = setTimeout(resolve, time);
cancel.then(() => {
clearTimeout(timer);
reject(new Error('Cancelled'));
});
using System;
using GameNetworkInterfaces;
using Moq;
using NUnit.Framework;
using TicTacToe.Core;
namespace TicTacToe.Tests
{
[TestFixture]
class GameEngineTests
using GameNetworkInterfaces;
using System;
namespace TicTacToe.Core
{
public class GameEngine
{
private ICommonGameNetworkControl _gameNetworkControl;
public GameEngine(ICommonGameNetworkControl gameNetworkControl)
@JamesBender
JamesBender / NebraskaCodeGameEngineTests
Created May 18, 2016 16:40
Game Engine Tests for TDD
using System;
using GameNetworkInterfaces;
using Moq;
using NUnit.Framework;
using TicTacToe.Core;
namespace TicTacToe.UnitTests
{
[TestFixture]
class GameEngineTests
using System;
using GameNetworkInterfaces;
namespace TicTacToe.Core
{
public class GameEngine
{
private ICommonGameNetworkControl _network;
public GameEngine(ICommonGameNetworkControl network)
using System;
using TicTacToe.Core.ExternalSystem;
namespace TicTacToe.Core
{
public class GameEngine
{
private ICommonGameNetworkControl _networkInterface;
public GameEngine(ICommonGameNetworkControl networkInterface)
using System;
using Moq;
using NUnit.Framework;
using TicTacToe.Core;
using TicTacToe.Core.ExternalSystem;
namespace TicTacToe.Tests
{
[TestFixture]
public class TicTacToeGameEngineTests
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TicTacToe.Core.GameNetworkInterfaces;
namespace TicTacToe.Core
{
public class GameEngine
using System;
using Moq;
using NUnit.Framework;
using TicTacToe.Core;
using TicTacToe.Core.GameNetworkInterfaces;
namespace TicTacToe.Tests
{
[TestFixture]
public class GameEngineTests
@JamesBender
JamesBender / ICommonGameNetworkControl.cs
Created November 11, 2015 22:13
ICommonGameNetworkControl and supporting classes for TDD-PreCon
using System;
using System.Collections.Generic;
namespace GameNetworkInterfaces
{
public interface ICommonGameNetworkControl
{
Guid Login(string username, string password);
bool Logout(Guid sessionToken);
int PostScoreToLeaderboard(Guid sessionToken, Guid gameToken, int score);