Skip to content

Issue with DateTime.Now #68

Open
Open

Description

@MelbourneDeveloper

I'm trying to get a basic sample working and I'm having difficulties. So, I added this test case to the existing unit tests:

[TestMethod]
public void TestReplace2()
{
    var expected = new DateTime(1999, 12, 31, 23, 59, 59);
    DateTime? actual = null;
    PoseContext.Isolate(() =>
    actual = DateTime.Now, Shim.Replace(() => DateTime.Now).
            With(() => expected));
    Assert.AreEqual(expected, actual.Value);
}

This fails. Am I doing something wrong, or is this a bug?

Assert.AreEqual failed. Expected:<31/12/1999 11:59:59 PM>. Actual:<25/10/2021 7:41:25 AM>.

Activity

  1. Miista commented on Jan 12, 2024

    @Miista

    @MelbourneDeveloper What version of Pose were you using?

    As mentioned in #79 there is a bug in versions above 1.1.0. Please see my comment there.

    Please see my comment on #63

  2. added a commit that references this issue on Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions