Home > OS >  How to get code coverage for specific property #C
How to get code coverage for specific property #C

Time:11-01

How do I get code coverage for specific properties? On an existing model I'm adding a property called AppTenantsCpgDisplay.

I need to cover that on my PR.

Not sure if it's possible do something like this?

I want to give it a GUID Value. Moc Guid value.

static private readonly IEnumerable<Guid> Display;

Model I'm calling on the test :

namespace Offers.Core.Models.Marketing
{
    public class AdvertOfferReadModel
    {
        public ReadModel();

        [JsonProperty("Display", Required = Required.Always)]
        public IEnumerable<Guid> Display { get; set; }
    }
}

CodePudding user response:

You don't need to test the behavior of an auto-generated property. You're not responsible for that correct behavior. The compiler is.

Properties with custom getter/setters are potential candidates for testing though as their correctness depends on your code rather than the compiler.

  • Related