Skip to content

Instantly share code, notes, and snippets.

View dsibinski's full-sized avatar

Dawid Sibiński dsibinski

View GitHub Profile
function GetManagedYearlySalary(person: Employee | Manager) {
if ('employees' in person) {
person.getYearlySalariesOfAllEmployees();
} else {
person.getYearlySalary();
}
}
class Person {
name: string;
constructor(name: string) {
this.name = name;
}
}
class Employee extends Person {
salary: number;
function GetNumberOrLength(variable: string | number): number {
if (typeof variable === 'string') {
return variable.length;
} else {
return variable;
}
}
function GetNumberOrLength(variable: string | number): number {
return (variable as string).length;
}
function GetNumberOrLength(variable: string | number): number {
return variable.length;
}
public class FormTests: CypressTestsBase
{
[Test]
public void SubmitTests()
{
// some data initialization code here....
RunCypressTest("form/submit_spec.ts");
}
}
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!");
}
class MyObject
{
public int Value { get; set; }
}
class MyObjectEnumerator
{
public bool MoveNext()
{
throw new NotImplementedException();
class MyObjectEnumerator
{
public bool MoveNext()
{
throw new NotImplementedException();
}
public void Reset()
{
throw new NotImplementedException();
class MyObjectEnumerator : IEnumerator<MyObject>
{
public bool MoveNext()
{
throw new NotImplementedException();
}
public void Reset()
{
throw new NotImplementedException();