Gilles TOURREAUgilles.tourreau.fr·Aug 20, 2024Simplifying Data Conversion: A Testable Approach for Entity Models and DTOsIn many applications, converting data from one format to another is a common task. For instance, you might need to convert a business entity object into JSON or vice versa. Many developers use extension methods like ToJson() or ToModel() for this con...Discuss·76 readsdto
Tadit Dashblog.taditdash.com·Feb 20, 2024Understanding Method Invocation Verification with Moq's Verifiable ConstructsIntroduction I encountered a scenario where I needed to test if a method inside another method was actually invoked. This led me to learn about the Verifiable construct in the Moq library. 💻 It provides a concrete way to ensure that the calls config...Discuss·161 readsunit testing
Gilles TOURREAUgilles.tourreau.fr·Dec 5, 2023Strengthening Moq based unit tests with PosInformatique.Moq.AnalyzersAs a passionate advocate for robust unit testing and code quality, I've invested heavily in leveraging the Moq library within my .NET projects. To ensure reliability and catch potential errors early, I developed a .NET analyzer tool specifically tail...Discuss·10 likes·58 reads.NET
Billy Mumbybilly-mumby-dev.com·Aug 22, 2023NSubstitute from MoqA concise and straightforward guide to transitioning from Moq to NSubstitute. Foreword There has been a recent issue with version 4.2.0 of the popular mocking library Moq. This is covered in many places by the community already, there is a great vide...Discuss·1 like·166 readsunit testing
Zahiruddin Tavargerezahere.com·Aug 14, 2023Moq Data-Collection Controversy: The Other Side of The StoryThe Context Moq is a very popular, open-source project that provides a mocking library for .NET developers. It has come under fire for quietly collecting data without the knowledge or consent of its users. Crux of The Matter Moq is was everything w...Discuss·1.2K readsOpen Source
Pritom Purkayastapritom.hashnode.dev·Aug 6, 2023DbContext, Dbset Mocking - C# made easyIntroduction Entity Framework Core is a popular Object-Relational Mapping (ORM) framework used by so many .NET developers for interacting with databases. One of the challenges we as developers face while unit testing code that interacts with database...Discuss·1 like·3.0K readsefcore
Ashok Kuduva Ananthanashokkuduvaananthan.hashnode.dev·Jun 24, 2023.NET 6 Web API Mocking DbContext & DbSet using MoqIn this article, we will explore how to create mock implementations for the DbContext and DbSet classes in Entity Framework, specifically targeting .NET 6 Web API applications. By following this step-by-step guide, you’ll gain insights into setting u...Discuss.net core
Davide Bellonecode4it.hashnode.dev·Aug 3, 2022Moq vs NSubstitute: syntax cheat sheetWhen writing Unit Tests, you usually want to mock dependencies. In this way, you can define the behavior of those dependencies, and have full control of the system under test. For .NET applications, two of the most used mocking libraries are Moq and ...Discuss·124 readsC#
Han Cheecodecultivation.com·Mar 14, 2018How to mock ASP.NET Core Identity?I was having a bit of issue when I tried to test my class which needs UserManager<ApplicationUser> object and RoleManager<IdentityRole> object in constructor method. Both classes are from new membership system called ASP.NET Core Identity. You can le...Discuss·224 readsunit test