umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

Interface for all modelsbuilder generated objects #7866

Closed Spijkerboer closed 4 years ago

Spijkerboer commented 4 years ago

To make unit testing al lot easier it would be nice if there is an interface generated for each modelsbuilder generated object. Currently interfaces are generated for compositions. It would be really helpful if they are generated for every type. This would make mocking a lot easier.

Because it's already being done for compositions I don't think I would be that difficult to do this.

dawoe commented 4 years ago

I thinks this can get really complex. Especially when you have a doctype that has compositions. On which interface do you generate the property.

If you end up with 2 interfaces unit testing will not be easier.

A quick solution could be to generate the properties as virtual. Than they can be mocked as well.

Dave

Spijkerboer commented 4 years ago

Hi Dave,

Thanks for your reply. Why can't the interface just inherit from the composition interface (like the classes are)

So: interface ITextPage: IDefaultComposition

dawoe commented 4 years ago

That could be done. But I like I said I think that will get to complex in generation and HQ will not want this. I'm assuming this because they are blocking this one as well : https://github.com/umbraco/Umbraco-CMS/issues/7734

nul800sebastiaan commented 4 years ago

Thanks @Spijkerboer - we're currently not looking to add new features to the embedded version of Modelsbuilder and will refer to the community version of Modelsbuilder for advanced functionality like this.

Spijkerboer commented 4 years ago

@nul800sebastiaan this was created because it might be something for a Duug hackaton.

nul800sebastiaan commented 4 years ago

@Spijkerboer Sure thing, but we do not wish to add new features to the embedded Modelsbuilder at this point. Sorry.