Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moq with ReturnAsync for GUID is not working #92

Open
m-venkat opened this issue Oct 16, 2023 · 0 comments
Open

Moq with ReturnAsync for GUID is not working #92

m-venkat opened this issue Oct 16, 2023 · 0 comments

Comments

@m-venkat
Copy link

m-venkat commented Oct 16, 2023

Here is the complete test method itself

[Test]
        public void QuerySingleOrDefaultAsyncGuidGenericUsingDbConnectionInterface()
        {
            var connection = new Mock<IDbConnection>();

            var expected = Guid.Parse("6e4655a7-de30-4bf7-ab86-21509d363104"); 

            connection.SetupDapperAsync(c => c.QuerySingleOrDefaultAsync<Guid>(It.IsAny<string>(), null, null, null, null))
                      .ReturnsAsync(expected);

            var actual = connection.Object.QuerySingleOrDefaultAsync<Guid>("").GetAwaiter().GetResult();

            Assert.AreEqual(actual, expected);
        }

If the type is not GUID it works fine, but if it is GUID it fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant