This file contains 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
function GetManagedYearlySalary(person: Employee | Manager) { | |
if ('employees' in person) { | |
person.getYearlySalariesOfAllEmployees(); | |
} else { | |
person.getYearlySalary(); | |
} | |
} |
This file contains 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
class Person { | |
name: string; | |
constructor(name: string) { | |
this.name = name; | |
} | |
} | |
class Employee extends Person { | |
salary: number; |
This file contains 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
function GetNumberOrLength(variable: string | number): number { | |
if (typeof variable === 'string') { | |
return variable.length; | |
} else { | |
return variable; | |
} | |
} |
This file contains 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
function GetNumberOrLength(variable: string | number): number { | |
return (variable as string).length; | |
} |
This file contains 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
function GetNumberOrLength(variable: string | number): number { | |
return variable.length; | |
} |
This file contains 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
public class FormTests: CypressTestsBase | |
{ | |
[Test] | |
public void SubmitTests() | |
{ | |
// some data initialization code here.... | |
RunCypressTest("form/submit_spec.ts"); | |
} | |
} |
This file contains 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
public class CypressTestsBase | |
{ | |
protected void RunCypressTest(string cypressSpecFilePath) | |
{ | |
var process = new System.Diagnostics.Process(); | |
var testAssemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | |
if (string.IsNullOrEmpty(testAssemblyPath)) | |
{ | |
throw new Exception("Cannot find test assembly path!"); | |
} |
This file contains 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
class MyObject | |
{ | |
public int Value { get; set; } | |
} | |
class MyObjectEnumerator | |
{ | |
public bool MoveNext() | |
{ | |
throw new NotImplementedException(); |
This file contains 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
class MyObjectEnumerator | |
{ | |
public bool MoveNext() | |
{ | |
throw new NotImplementedException(); | |
} | |
public void Reset() | |
{ | |
throw new NotImplementedException(); |
This file contains 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
class MyObjectEnumerator : IEnumerator<MyObject> | |
{ | |
public bool MoveNext() | |
{ | |
throw new NotImplementedException(); | |
} | |
public void Reset() | |
{ | |
throw new NotImplementedException(); |