From 485ff0ea783d68772c8e9f89ea7202026787bb51 Mon Sep 17 00:00:00 2001 From: webwarrior Date: Wed, 6 Dec 2023 10:10:07 +0100 Subject: [PATCH] Core.Tests: added 2 more tests Added unit tests where `__` and `this` is used (instead of self). --- .../Conventions/SuggestUseAutoProperty.fs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/FSharpLint.Core.Tests/Rules/Conventions/SuggestUseAutoProperty.fs b/tests/FSharpLint.Core.Tests/Rules/Conventions/SuggestUseAutoProperty.fs index 353777287..b08a775c7 100644 --- a/tests/FSharpLint.Core.Tests/Rules/Conventions/SuggestUseAutoProperty.fs +++ b/tests/FSharpLint.Core.Tests/Rules/Conventions/SuggestUseAutoProperty.fs @@ -17,6 +17,24 @@ type Foo(content: int) = Assert.IsTrue(this.ErrorsExist) + [] + member this.``Should suggest usage of auto-property for property that only returns immutable value (this self-identifier)`` () = + this.Parse """ +type Foo(content: int) = + member this.Content = content +""" + + Assert.IsTrue(this.ErrorsExist) + + [] + member this.``Should suggest usage of auto-property for property that only returns immutable value (__ self-identifier)`` () = + this.Parse """ +type Foo(content: int) = + member __.Content = content +""" + + Assert.IsTrue(this.ErrorsExist) + [] member this.``Should suggest usage of auto-property for property that only returns literal`` () = this.Parse """