Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyze unit test asserts #5

Open
angularsen opened this issue Oct 6, 2020 · 0 comments
Open

Analyze unit test asserts #5

angularsen opened this issue Oct 6, 2020 · 0 comments

Comments

@angularsen
Copy link
Owner

angularsen commented Oct 6, 2020

Relates to #2 .

It would be helpful to get a compile error if a particular property is not accessed in an assert section of a unit test. This helps keep tests up to date when new properties are added.

Syntax proposal

Use // AccessAll {identifier list} to list all variables that should have their properties read or written.
Use :read or :write to specify type of access. Defaults to any of them.

// AccessAll slot:read
// The above comment will enable analyzer for the 'slot' variable and its properties.
// If any of its properties are not read, a compile error is generated.
slot.Price.Should().NotBeNull();
slot.Duration.Should().Be(TimeSpan.FromHours(2));
slot.Price.Currency.Should().Be("NOK");
slot.Price.AppliedDiscounts.Should().BeEmpty();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant