Skip to content

Commit

Permalink
GetNow now.txt documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
codeape2 committed Nov 21, 2016
1 parent e50be6d commit 0c2b42d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions netmockery/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ Command line:
# execute request specified by test N, but display respons (do not check test expectations)
netmockery.exe p:\ath\to\endpoint\directory test --only N --showResponse

## Handling time when testing

* If you have scripts that need the current date/time, do not use ``System.DateTime.Now``.
* Instead, use the ``GetNow()`` function inside your scripts.
* When netmockery is running serving requests in the normal case, ``GetNow()`` returns ``System.DateTime.Now``.
* But when running tests, ``GetNow()`` will return the timestamp specified in the special file ``tests\now.txt``. This file should contain a single line with the time stamp
in ``yyyy-MM-dd HH:mm:ss`` format.
* Using ``GetNow()`` / ``now.txt`` you can create stable test cases, even if your scripted service simulators return dynamic data based on current time.

<a name="misc"></a>
# Misc

Expand Down

0 comments on commit 0c2b42d

Please sign in to comment.