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 AutoFixture; | |
using AutoFixture.AutoMoq; | |
using Moq; | |
using Xunit; | |
namespace AutoFixtureSandbox.Tests | |
{ | |
public class AutoFixtureLearningTests | |
{ | |
[Fact] |
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 Ploeh.AutoFixture.Xunit2; | |
using Xunit; | |
namespace AutoFixtureSandbox.Tests | |
{ | |
public class AutoFixtureLearningTests | |
{ | |
[Theory] | |
[AutoData] | |
public void CanAddNumber(decimal x, Calculator sut) |
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 System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using Ploeh.AutoFixture; | |
using Ploeh.AutoFixture.Kernel; | |
using Xunit; | |
namespace AutoFixtureSandbox.Tests | |
{ |
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 fixture = new Fixture(); | |
//Primitives | |
var anonymousStr = fixture.Create<string>("This str makes it easier to read failed tests."); | |
var anonymousInt = fixture.Create<int>(); | |
//Collections | |
var anonymousCollection = fixture.CreateMany<int>(); | |
var limitedAnonymousCollection = fixture.CreateMany<string>(3); |
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
db.createUser({ | |
user: "Kusken", | |
pwd: ***, | |
roles: ["readWrite", "dbAdmin"] | |
}); | |
db.createCollection("customers"); | |
show collections |
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
//1.0 - Typed function types | |
//Synatx 1 | |
let addition1 = | |
function (x: number, y: number): number { return x + y; }; | |
console.log(addition1(5, 5)); | |
//Synatx 2 | |
let addition2 = (x: number, y: number) => { return x + y; }; |
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
//1.0 TypeScript Inheritance | |
class Diety { | |
constructor(protected name: string) { | |
} | |
} | |
interface IDietyAction { | |
(name: string): void | |
}; |
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
//1.0 Interface declared on function | |
function printBirthday(birthday: { Date: Date, Age: number, Name: string}) { | |
console.log(birthday.Name + "'s " + (birthday.Age + 1) + "th birthday" | |
+ " is on " + birthday.Date + "."); | |
} | |
let person = { Name: "Karl", Age: 32, Date: new Date(), Occupation: "Painter" }; | |
printBirthday(person); |
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
//Destructuring Examples | |
//1.0 Array destructing | |
let travelClasses = [200, 500, 1000]; | |
let [economy, business, first] = travelClasses; | |
console.log("Business class price:" + business); //500 |
NewerOlder