UnitTestBoilerplateGenerator icon indicating copy to clipboard operation
UnitTestBoilerplateGenerator copied to clipboard

using System.Drawing; was not added as one of the auto generated using statements

Open AndreaWilliamsIteris opened this issue 3 years ago • 5 comments

Installed product versions

  • Visual Studio: [example 2017 Professional]
  • This extension: [example 2.7.0]

Description

When I created boiler plate unit test, the using statement did not get added and I had to add in myself. using System.Drawing;

Steps to recreate

  1. Add this to code var newLabel = new DevExpress.XtraEditors.LabelControl { Text = name, Width = 150, Font = font, AutoSizeMode = LabelAutoSizeMode.Vertical, AutoSize = true, Dock = DockStyle.Left, };

  2. Create a Unit test

  3. Font has red squiggle because using statement is missing.

Current behavior

using statement is missing because system.drawing is not referenced

Expected behavior

using System.Drawing; is included in the unit test file and Font doesn't have a missing reference.

AndreaWilliamsIteris avatar Jul 06 '22 15:07 AndreaWilliamsIteris

Did you put System.Drawing in the Extra "using" namespaces field in Options? image

RandomEngy avatar Jul 09 '22 05:07 RandomEngy

No... I didn't see that field. I was under the impression that it would include all of the using's from the code file. Maybe that should be a feature request?

AndreaWilliamsIteris avatar Jul 11 '22 18:07 AndreaWilliamsIteris

Maybe? Many times, you don't actually want all of the using statements that the source file has. I'll consider it as an option.

RandomEngy avatar Jul 12 '22 05:07 RandomEngy

But you can always remove them later. I'd rather have too many and delete the extra's than have to hunt down what is missing, personally.

Also, not all the 'usings' that I add to the 'Extra "using" namespaces are going to be needed for all my files, so I'm adding 'usings' that I don't need in that case.

There are a LOT of using statements in the code file with which I'm working. I'd rather not have to add them all to this field.

AndreaWilliamsIteris avatar Jul 12 '22 14:07 AndreaWilliamsIteris

Yeah that field is really more for if you included some extra test library that was always used in the template. It's a reasonable feature request. Might be a while until I can get to it as I'm busy with some other projects, but I'm always accepting PRs.

RandomEngy avatar Jul 15 '22 04:07 RandomEngy