Example in JavaScript

The following is an example of a MockDateTimeService in JavaScript. Much like the MockDateTimeService in C#, this allows you to set the DateTime to be returned by the service in order to reliably test how other parts of the system might behave based on specific DateTimes.

export class MockDateTimeService {
constructor() {
this.currentDateTime = new Date(2000, 0, 1);
}

now() {
return this.currentDateTime;
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.172.200