mattwhitfield / Unitverse

A unit test generation extension for Visual Studio that aims to always produce code that compiles - covering the basic cases automatically and preparing as much as it can for the complex cases.
MIT License
89 stars 20 forks source link

Support MockBehavior.Strict by default when using Moq #157

Closed guitoux1 closed 1 year ago

guitoux1 commented 1 year ago

When using Moq for as mocking framework, it would be nice to have an option to generate the mock using the MockBehavior.Strict behaviour on constructor, like :

        [TestInitialize]
        public void SetUp()
        {
            _contactRepository = new Mock<IContactRepository>(MockBehavior.Strict);
            _testClass = new ContactService(_contactRepository.Object);
        }

And thank you for that awesome tool !

mattwhitfield commented 1 year ago

Thanks for the suggestion!

I've added an option - available in 0.156 💥

It won't do anything different for AutoFixture, seeing as MockBehavior.Strict support isn't built in to that library.

Please let me know if this works for you, and if you have 5 minutes a review on the VS Marketplace would be much appreciated 😁

guitoux1 commented 1 year ago

It works perfectly thanks !