This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class BowlingServiceParserTest | |
{ | |
[TestMethod] | |
public void number_from_one_to_nine_translate_to_the_number() | |
{ | |
int[] result = BowlingServiceParser.Parse("123456789"); | |
CollectionAssert.AreEqual(new int[] {1,2,3,4,5,6,7,8,9}, result); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Express = require( "express" ) | |
const Expression = require( "express-session" ) | |
const app = Express() | |
app.use( Expression( { | |
secret: "secret", | |
resave: false, | |
saveUninitialized: false | |
} ) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var index = ( function () { | |
var exports = {} | |
exports.start = function() { | |
console.log( "Main::start" ) | |
$( "#frm" ).on( "submit", function( event ) { | |
var newGreeting = { | |
id: utils.generateId(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type GameInfo = { code: string } | |
export type GameEntity = { id: string, code: string, date: string, rolls: string } | |
export type RemoteGameData = { datePlayed: string, rolls: string } | |
export interface RemoteDataService { | |
fetch ( code: String ): Promise<RemoteGameData> | |
} | |
export interface IdentityService { | |
generate (): string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it( "should send an email message", function() { | |
var es = new EmailService(); | |
var expectation = sinon | |
.mock( es ) | |
.expects( "sendEmail" ) | |
.withArgs( "Whazzup, Joe!" ); | |
var g = new Greeting2( es ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it( "should build a greeting based on age", function() { | |
var ds = new DataService(); | |
sinon.stub( ds, "getMessageBasedOnAge" ) | |
.withArgs( 20 ) | |
.returns( "Yo" ); | |
var g = new Greeting1( ds ); | |
var message = g.build( "Joe", 20 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using Moq; | |
[TestClass] | |
public class MockingTests | |
{ | |
[TestMethod] | |
public void should_send_an_email() | |
{ | |
var mockEmailService = new Mock<IEmailService>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using Moq; | |
[TestClass] | |
public class StubbingTests | |
{ | |
[TestMethod] | |
public void should_build_a_greeting_based_on_age() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://grn4aewhhg.execute-api.us-east-1.amazonaws.com/prod/games |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var main = require( "./main" ) | |
test( "sanity", function() { | |
var result = main.foo() | |
expect( result ).toBe( "foo" ) | |
} ) |