fluentassertions / fluentassertions/fluentassertions.analyzers
Create a refactoring for asserting exceptions properties
- Lingua principale
- C#
- Stelle
- 131
- Fork
- 25
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
for example:
```cs
public class MyCustomException : Exception
{
public string MyCustomProperty { get; }
public MyCustomException(string myCustomProperty)
{
MyCustomProperty = MyCustomProperty;
}
}
```
when hovering over the property `MyCustomProperty` I would like to have a suggestion to generate an assertion for that property.
The generated assertion will something like this:
```cs
public static class MyCustomExceptionExtensions
{
public static ExceptionAssertions WithMyCustomProperty(this ExceptionAssertions assertions,
string expectedMyCustomProperty, string because = "", params object[] becauseArgs) where TException : MyCustomException
{
Execute.Assertion
.ForCondition(assertions.And.MyCustomProperty.Equals(expectedMyCustomProperty))
.BecauseOf(because, becauseArgs)
.FailWith("Expected exception with MyCustomProperty {0}{reason}, but found {1}.", assertions.And.MyCustomProperty, expectedMyCustomProperty);
return assertions;
}
}
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
No files, tests, or entry points are named in the issue, so first locate the analyzer's refactoring implementations and their tests. Use the requested C# exception-property example to define the generated assertion and verify that hovering over a property offers the refactoring with the expected output.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- devtools, testing-qa
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100