It happens from time to time that I forget to implement some code where I’m just throwing a NotImplementedException. Being forgetful I have a habit of coming up with stuff that will help me not to forget. I think my “MustBeImplementedException” is quite useful, it will break the build if the build is not DEBUG.
#if DEBUG namespace FakeItEasy { using System; using System.Diagnostics.CodeAnalysis; /// <summary> /// An exception that can be thrown before a member has been /// implemented, will cause the build to fail when not built in /// debug mode. /// </summary> [Serializable] [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Justification = "Never used in production.")] public class MustBeImplementedException : Exception { } } #endif
Why are the methods using the NotImplementedException not included in a unittest? :-)
ReplyDeleteI like the idea of using a custom exception to flag unimplemented code.
ReplyDeleteSA Auto Care, founded in 2014, is a prominent vehicle service provider in South Australia that caters to all aspects of vehicle needs with end-to-end solutions. Having more than a decade of experience, the company has earned a solid image in the region with high-quality towing, repair, used car sales, and warranty services for customers. Their staff of expert professionals, experienced mechanics, and auto specialists are dedicated to offering top-notch care and personalized service to each customer. SA Auto Care repairs all makes and models of cars and provides the best quality care to each vehicle local mechanic Adelaide. They also provide extended warranties between 1 to 5 years and 24/7 Australia-wide roadside services. Trade-ins are accepted, and their second-hand car listings are online for viewing. For dependable and effective car services in Adelaide and beyond, SA Auto Care is the reliable option.
ReplyDelete