├── .github
├── CODEOWNERS
├── dependabot.yml
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── SECURITY.md
└── pull_request_template.md
├── codecov.yml
├── src
├── Fluentify.Console.Tests
│ ├── Fluentify.Console.Tests.csproj
│ ├── Record
│ │ ├── Example
│ │ │ └── Simple
│ │ │ │ ├── MyServiceBuilderTests
│ │ │ │ └── WhenMyServiceIsBuilt.cs
│ │ │ │ └── MovieTests
│ │ │ │ └── WhenMovieIsBuilt.cs
│ │ ├── SingleTests
│ │ │ └── WhenWithAgeIsCalled.cs
│ │ ├── SimpleTests
│ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ ├── WhenWithNameIsCalled.cs
│ │ │ └── WhenWithAgeIsCalled.cs
│ │ ├── GlobalRecordTests
│ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ ├── WhenWithNameIsCalled.cs
│ │ │ └── WhenWithAgeIsCalled.cs
│ │ ├── Descriptor
│ │ │ ├── OnIgnoredTests
│ │ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ │ └── WhenWithAgeIsCalled.cs
│ │ │ ├── OnOptionalTests
│ │ │ │ ├── WhenAttributedWithIsCalled.cs
│ │ │ │ └── WhenWithNameIsCalled.cs
│ │ │ └── OnRequiredTests
│ │ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ │ ├── WhenWithNameIsCalled.cs
│ │ │ │ └── WhenAgedIsCalled.cs
│ │ ├── Ignore
│ │ │ ├── OneOfThreeTests
│ │ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ │ └── WhenWithAgeIsCalled.cs
│ │ │ └── TwoOfThreeTests
│ │ │ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── SelfDescriptor
│ │ │ ├── OnOptionalTests
│ │ │ │ ├── WhenAttributesIsCalled.cs
│ │ │ │ └── WhenWithNameIsCalled.cs
│ │ │ ├── OnIgnoredTests
│ │ │ │ └── WhenWithAttributesIsCalled.cs
│ │ │ └── OnRequiredTests
│ │ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ │ ├── WhenWithNameIsCalled.cs
│ │ │ │ └── WhenAgeIsCalled.cs
│ │ ├── CrossReferencedTests
│ │ │ └── WhenWithDescriptionIsCalled.cs
│ │ ├── NestedInClassTests
│ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ └── WhenWithNameIsCalled.cs
│ │ ├── NestedInRecordTests
│ │ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── NestedInStructTests
│ │ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── SingleGenericTests
│ │ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── SimpleWithBooleanTests
│ │ │ ├── WhenWithNameIsCalled.cs
│ │ │ └── WhenWithAgeIsCalled.cs
│ │ ├── NestedInInterfaceTests
│ │ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── NestedInRefStructTests
│ │ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── SimpleWithArrayTests
│ │ │ └── WhenWithNameIsCalled.cs
│ │ └── NestedInRecordStructTests
│ │ │ └── WhenWithAttributesIsCalled.cs
│ └── Class
│ │ ├── SingleTests
│ │ └── WhenWithAgeIsCalled.cs
│ │ ├── SkipAutoInstantiationTests
│ │ └── WhenWithDependencyIsCalled.cs
│ │ ├── SimpleTests
│ │ ├── WhenWithAttributesIsCalled.cs
│ │ ├── WhenWithNameIsCalled.cs
│ │ └── WhenWithAgeIsCalled.cs
│ │ ├── GlobalClassTests
│ │ ├── WhenWithAttributesIsCalled.cs
│ │ ├── WhenWithNameIsCalled.cs
│ │ └── WhenWithAgeIsCalled.cs
│ │ ├── Ignore
│ │ ├── OneOfThreeTests
│ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ └── WhenWithAgeIsCalled.cs
│ │ └── TwoOfThreeTests
│ │ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── SelfDescriptor
│ │ ├── OnOptionalTests
│ │ │ ├── WhenAttributesIsCalled.cs
│ │ │ └── WhenWithNameIsCalled.cs
│ │ ├── OnIgnoredTests
│ │ │ └── WhenWithAttributesIsCalled.cs
│ │ └── OnRequiredTests
│ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ ├── WhenWithNameIsCalled.cs
│ │ │ └── WhenAgeIsCalled.cs
│ │ ├── CrossReferencedTests
│ │ └── WhenWithDescriptionIsCalled.cs
│ │ ├── Descriptor
│ │ ├── OnIgnoredTests
│ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ └── WhenWithAgeIsCalled.cs
│ │ ├── OnOptionalTests
│ │ │ ├── WhenAttributedWithIsCalled.cs
│ │ │ └── WhenWithNameIsCalled.cs
│ │ └── OnRequiredTests
│ │ │ ├── WhenWithAttributesIsCalled.cs
│ │ │ ├── WhenWithNameIsCalled.cs
│ │ │ └── WhenAgedIsCalled.cs
│ │ ├── NestedInClassTests
│ │ ├── WhenWithAttributesIsCalled.cs
│ │ └── WhenWithNameIsCalled.cs
│ │ ├── NestedInRecordTests
│ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── NestedInStructTests
│ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── SingleGenericTests
│ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── SimpleWithBooleanTests
│ │ ├── WhenWithNameIsCalled.cs
│ │ └── WhenWithAgeIsCalled.cs
│ │ ├── NestedInInterfaceTests
│ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── NestedInRefStructTests
│ │ └── WhenWithAttributesIsCalled.cs
│ │ ├── SimpleWithArrayTests
│ │ └── WhenWithNameIsCalled.cs
│ │ └── NestedInRecordStructTests
│ │ └── WhenWithAttributesIsCalled.cs
├── Fluentify.Tests
│ ├── Semantics
│ │ ├── Definition.cs
│ │ ├── DefinitionExtensions.GetParameter.cs
│ │ ├── DefinitionExtensions.GetProperty.cs
│ │ ├── Classes.cs
│ │ └── Records.cs
│ ├── Snippets
│ │ ├── Extensions.cs
│ │ ├── Records.Unsupported.cs
│ │ ├── Classes.Unsupported.cs
│ │ ├── Generated.cs
│ │ ├── Records.Unannotated.cs
│ │ ├── Classes.Unannotated.cs
│ │ ├── Declared.cs
│ │ ├── Classes.AllThreeIgnored.cs
│ │ └── DeclaredAttribute.cs
│ ├── Model
│ │ ├── NestingTests
│ │ │ ├── WhenEqualityIsCheckedByOperator.cs
│ │ │ ├── WhenInequalityIsCheckedByOperator.cs
│ │ │ ├── WhenEqualityIsCheckedByEquatable.cs
│ │ │ └── WhenEqualityIsCheckedByEquals.cs
│ │ ├── KindTests
│ │ │ ├── WhenEqualityIsCheckedByOperator.cs
│ │ │ ├── WhenEqualityIsCheckedByEquals.cs
│ │ │ └── WhenEqualityIsCheckedByEquatable.cs
│ │ ├── TypeTests
│ │ │ ├── WhenEqualityIsCheckedByOperator.cs
│ │ │ ├── WhenInequalityIsCheckedByOperator.cs
│ │ │ ├── WhenEqualityIsCheckedByEquals.cs
│ │ │ └── WhenEqualityIsCheckedByEquatable.cs
│ │ ├── GenericTests
│ │ │ ├── WhenEqualityIsCheckedByOperator.cs
│ │ │ ├── WhenInequalityIsCheckedByOperator.cs
│ │ │ ├── WhenEqualityIsCheckedByEquatable.cs
│ │ │ └── WhenEqualityIsCheckedByEquals.cs
│ │ ├── SubjectTests
│ │ │ ├── WhenEqualityIsCheckedByOperator.cs
│ │ │ ├── WhenInequalityIsCheckedByOperator.cs
│ │ │ ├── WhenEqualityIsCheckedByEquatable.cs
│ │ │ └── WhenEqualityIsCheckedByEquals.cs
│ │ └── PropertyTests
│ │ │ ├── WhenEqualityIsCheckedByOperator.cs
│ │ │ ├── WhenInequalityIsCheckedByOperator.cs
│ │ │ ├── WhenEqualityIsCheckedByEquals.cs
│ │ │ └── WhenEqualityIsCheckedByEquatable.cs
│ ├── IgnoreAttributeGeneratorTests
│ │ └── WhenExecuted.cs
│ ├── FluentifyAttributeGeneratorTests
│ │ └── WhenExecuted.cs
│ ├── InternalExtensionsGeneratorTests
│ │ └── WhenExecuted.cs
│ ├── DescriptorAttributeGeneratorTests
│ │ └── WhenExecuted.cs
│ ├── SkipAutoInstantiationAttributeGeneratorTests
│ │ └── WhenExecuted.cs
│ ├── Fluentify.Tests.csproj
│ ├── GeneratorTests.cs
│ ├── IgnoreAttributeAnalyzerTests
│ │ └── WhenExecuted.cs
│ ├── ClassGeneratorTests
│ │ └── WhenExecuted.cs
│ └── RecordGeneratorTests
│ │ └── WhenExecuted.cs
├── Fluentify
│ ├── AnalyzerReleases.Unshipped.md
│ ├── Semantics
│ │ ├── ITypeSymbolExtensions.IsNullable.cs
│ │ ├── ISymbolExtensions.HasIgnore.cs
│ │ ├── ISymbolExtensions.HasAttribute.cs
│ │ ├── IPropertySymbolExtensions.HasIgnore.cs
│ │ ├── INamedTypeSymbolExtensions.HasFluentify.cs
│ │ ├── IPropertySymbolExtensions.HasSkipAutoInstantiation.cs
│ │ ├── INamedTypeSymbolExtensions.GetGenerics.cs
│ │ ├── IPropertySymbolExtensions.HasAttribute.cs
│ │ ├── IPropertySymbolExtensions.GetParameter.cs
│ │ └── ISymbolExtensions.GetAttribute.cs
│ ├── Source
│ │ ├── PropertyExtensions.GetScalarExtensionMethodBody.cs
│ │ ├── PropertyExtensions.GetScalarDelegateExtensionMethodBody.cs
│ │ ├── GenericExtensions.ToConstraints.cs
│ │ ├── GenericExtensions.ToParameters.cs
│ │ ├── Metadata.cs
│ │ ├── PropertyExtensions.GetArrayExtensionMethodBody.cs
│ │ └── PropertyExtensions.GetCollectionExtensionMethodBody.cs
│ ├── FluentifyAttributeGenerator.cs
│ ├── IgnoreAttributeGenerator.cs
│ ├── Model
│ │ ├── Generic.cs
│ │ ├── Pattern.cs
│ │ └── Nesting.cs
│ ├── SkipAutoInstantiationAttributeGenerator.cs
│ ├── Syntax
│ │ └── TypeDeclarationSyntaxExtensions.IsPartial.cs
│ └── FluentifyGenerator.Source.cs
└── Fluentify.Console
│ ├── Record
│ ├── Single.cs
│ ├── Example
│ │ └── Simple
│ │ │ ├── Genre.cs
│ │ │ ├── Actor.cs
│ │ │ ├── Movie.cs
│ │ │ └── MyServiceBuilder.cs
│ ├── CrossReferenced.cs
│ ├── SimpleWithBoolean.cs
│ ├── Simple.cs
│ ├── SimpleWithArray.cs
│ ├── SimpleWithCollection.cs
│ ├── Ignore
│ │ ├── OneOfThree.cs
│ │ ├── TwoOfThree.cs
│ │ └── AllThree.cs
│ ├── Descriptor
│ │ ├── OnRequired.cs
│ │ ├── OnIgnored.cs
│ │ └── OnOptional.cs
│ ├── SelfDescriptor
│ │ ├── OnOptional.cs
│ │ ├── OnRequired.cs
│ │ └── OnIgnored.cs
│ ├── SingleGeneric.cs
│ ├── NestedInClass.cs
│ ├── NestedInStruct.cs
│ ├── NestedInRecord.cs
│ ├── NestedInRefStruct.cs
│ ├── NestedInRecordStruct.cs
│ ├── NestedInReadOnlyStruct.cs
│ ├── NestedInRefRecordStruct.cs
│ ├── MultipleGenerics.cs
│ ├── SimpleWithEnumerables.cs
│ ├── GlobalRecord.cs
│ └── NestedInInterface.cs
│ ├── SkipAutoInstantiation.cs
│ ├── Class
│ ├── Single.cs
│ ├── CrossReferenced.cs
│ ├── Simple.cs
│ ├── SimpleWithBoolean.cs
│ ├── SimpleWithArray.cs
│ ├── SimpleWithCollection.cs
│ ├── Descriptor
│ │ ├── OnRequired.cs
│ │ └── OnOptional.cs
│ ├── SelfDescriptor
│ │ ├── OnOptional.cs
│ │ └── OnRequired.cs
│ ├── Ignore
│ │ ├── OneOfThree.cs
│ │ ├── TwoOfThree.cs
│ │ └── AllThree.cs
│ ├── SingleGeneric.cs
│ ├── GlobalClass.cs
│ └── SkipAutoInstantiation
│ │ ├── Example.cs
│ │ └── CollectionExample.cs
│ ├── Program.cs
│ └── Fluentify.Console.csproj
├── .vscode
└── settings.json
├── packages
└── README.md
├── scripts
└── README.md
├── nuget.config
├── .filenesting.json
├── .devcontainer
└── devcontainer.json
├── .runsettings
└── LICENSE
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @MooVC
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 |
2 | coverage:
3 | ignore:
4 | - "**/*.Console/*"
5 |
--------------------------------------------------------------------------------
/src/Fluentify.Console.Tests/Fluentify.Console.Tests.csproj:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "dotnet-test-explorer.testProjectPath": "**/*.sln",
3 | "editor.renderWhitespace": "all"
4 | }
--------------------------------------------------------------------------------
/packages/README.md:
--------------------------------------------------------------------------------
1 | This file has been added to enable folder commit to the repository. The file can be deleted once that commit has been successful.
--------------------------------------------------------------------------------
/scripts/README.md:
--------------------------------------------------------------------------------
1 | This file has been added to enable folder commit to the repository. The file can be deleted once that commit has been successful.
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Semantics/Definition.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Semantics;
2 |
3 | using Microsoft.CodeAnalysis;
4 | using Microsoft.CodeAnalysis.CSharp.Syntax;
5 |
6 | public sealed record Definition(INamedTypeSymbol Symbol, TypeDeclarationSyntax Syntax);
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Snippets/Extensions.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Snippets;
2 |
3 | public static class Extensions
4 | {
5 | public static readonly Generated Internal = new(InternalExtensionsGenerator.Source, typeof(InternalExtensionsGenerator), "Fluentify.Internal.Extensions");
6 | }
--------------------------------------------------------------------------------
/src/Fluentify/AnalyzerReleases.Unshipped.md:
--------------------------------------------------------------------------------
1 | ### New Rules
2 |
3 | Rule ID | Category | Severity | Notes
4 | --------|----------|----------|-------
5 | FLTFY08 | Design | Warning | FLTFY08_RecordAnalyzer, [Documentation](https://github.com/MooVC/Fluentify/blob/master/docs/rules/FLTFY08.md)
6 |
--------------------------------------------------------------------------------
/src/Fluentify.Console/Record/Single.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Console.Record;
2 |
3 | ///
4 | /// A record that demonstrates the libraries use on a type with just one property.
5 | ///
6 | /// The first property to be subject to the extension generator.
7 | [Fluentify]
8 | internal sealed partial record Single(int Age);
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/NestingTests/WhenEqualityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.NestingTests;
2 |
3 | public sealed class WhenEqualityIsCheckedByOperator
4 | : WhenEqualityIsChecked
5 | {
6 | private protected override bool AreEqual(Nesting? instance1, Nesting? instance2)
7 | {
8 | return instance1 == instance2;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/NestingTests/WhenInequalityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.NestingTests;
2 |
3 | public sealed class WhenInequalityIsCheckedByOperator
4 | : WhenInequalityIsChecked
5 | {
6 | private protected override bool AreNotEqual(Nesting? instance1, Nesting? instance2)
7 | {
8 | return instance1 != instance2;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/Fluentify.Console/SkipAutoInstantiation.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Records.Testing;
2 |
3 | [Fluentify]
4 | public sealed partial record SkipAutoInstantiation(
5 | int Age,
6 | [SkipAutoInstantiation] SkipAutoInstantiation.Dependent Dependency)
7 | {
8 | public sealed class Dependent
9 | {
10 | public string Name { get; set; } = string.Empty;
11 | }
12 | }
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/KindTests/WhenEqualityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.KindTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByOperator
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Kind? instance1, Kind? instance2)
9 | {
10 | return instance1 == instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/TypeTests/WhenEqualityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.TypeTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByOperator
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Type? instance1, Type? instance2)
9 | {
10 | return instance1 == instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/GenericTests/WhenEqualityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.GenericTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByOperator
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Generic? instance1, Generic? instance2)
9 | {
10 | return instance1 == instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/SubjectTests/WhenEqualityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.SubjectTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByOperator
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Subject? instance1, Subject? instance2)
9 | {
10 | return instance1 == instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/TypeTests/WhenInequalityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.TypeTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenInequalityIsCheckedByOperator
6 | : WhenInequalityIsChecked
7 | {
8 | private protected override bool AreNotEqual(Type? instance1, Type? instance2)
9 | {
10 | return instance1 != instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/PropertyTests/WhenEqualityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.PropertyTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByOperator
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Property? instance1, Property? instance2)
9 | {
10 | return instance1 == instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/GenericTests/WhenInequalityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.GenericTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenInequalityIsCheckedByOperator
6 | : WhenInequalityIsChecked
7 | {
8 | private protected override bool AreNotEqual(Generic? instance1, Generic? instance2)
9 | {
10 | return instance1 != instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/SubjectTests/WhenInequalityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.SubjectTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenInequalityIsCheckedByOperator
6 | : WhenInequalityIsChecked
7 | {
8 | private protected override bool AreNotEqual(Subject? instance1, Subject? instance2)
9 | {
10 | return instance1 != instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/.filenesting.json:
--------------------------------------------------------------------------------
1 | {
2 | "help": "https://go.microsoft.com/fwlink/?linkid=866610",
3 | "root": true,
4 | "dependentFileProviders": {
5 | "add": {
6 | "pathSegment": {
7 | "add": {
8 | ".*": [ ".cs" ]
9 | }
10 | },
11 | "fileSuffixToExtension": {
12 | "add": {
13 | ".Resources.resx": [ ".cs" ]
14 | }
15 | }
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/PropertyTests/WhenInequalityIsCheckedByOperator.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.PropertyTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenInequalityIsCheckedByOperator
6 | : WhenInequalityIsChecked
7 | {
8 | private protected override bool AreNotEqual(Property? instance1, Property? instance2)
9 | {
10 | return instance1 != instance2;
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Snippets/Records.Unsupported.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Snippets;
2 |
3 | public static partial class Records
4 | {
5 | public const string UnsupportedContent = """
6 | namespace Fluentify.Records.Testing
7 | {
8 | [Fluentify]
9 | public sealed record Unsupported();
10 | }
11 | """;
12 |
13 | public static readonly Declared Unsupported;
14 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Snippets/Classes.Unsupported.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Snippets;
2 |
3 | public static partial class Classes
4 | {
5 | public const string UnsupportedContent = """
6 | namespace Fluentify.Classes.Testing
7 | {
8 | [Fluentify]
9 | public sealed class Unsupported
10 | {
11 | }
12 | }
13 | """;
14 |
15 | public static readonly Declared Unsupported;
16 | }
--------------------------------------------------------------------------------
/src/Fluentify.Console/Record/Example/Simple/Genre.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Console.Record.Example.Simple;
2 |
3 | ///
4 | /// A recreation of the example provided in the README.md.
5 | ///
6 | public enum Genre
7 | {
8 | ///
9 | /// A sample genre to facilitate testing.
10 | ///
11 | Horror,
12 |
13 | ///
14 | /// A sample genre to facilitate testing.
15 | ///
16 | SciFi,
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Snippets/Generated.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Snippets;
2 |
3 | using System.Diagnostics;
4 | using Microsoft.CodeAnalysis.Testing;
5 |
6 | [DebuggerDisplay("{Hint,nq}")]
7 | public sealed record Generated(string Content, Type Generator, string Hint)
8 | {
9 | public void IsExpectedIn(SolutionState state)
10 | {
11 | state.GeneratedSources.Add((sourceGeneratorType: Generator, filename: $"{Hint}.g.cs", content: Content));
12 | }
13 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/NestingTests/WhenEqualityIsCheckedByEquatable.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.NestingTests;
2 |
3 | public sealed class WhenEqualityIsCheckedByEquatable
4 | : WhenEqualityIsChecked
5 | {
6 | private protected override bool AreEqual(Nesting? instance1, Nesting? instance2)
7 | {
8 | if (instance1 is not null)
9 | {
10 | return instance1.Equals(instance2);
11 | }
12 |
13 | return true;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/NestingTests/WhenEqualityIsCheckedByEquals.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.NestingTests;
2 |
3 | public sealed class WhenEqualityIsCheckedByEquals
4 | : WhenEqualityIsChecked
5 | {
6 | private protected override bool AreEqual(Nesting? instance1, Nesting? instance2)
7 | {
8 | if (instance1 is not null)
9 | {
10 | return instance1.Equals((object?)instance2);
11 | }
12 |
13 | return true;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Semantics/DefinitionExtensions.GetParameter.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Semantics;
2 |
3 | using Microsoft.CodeAnalysis;
4 |
5 | internal static partial class DefinitionExtensions
6 | {
7 | public static IParameterSymbol GetParameter(this Definition definition, string name)
8 | {
9 | IPropertySymbol property = definition.GetProperty(name);
10 | IParameterSymbol? parameter = property.GetParameter();
11 |
12 | return parameter!;
13 | }
14 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/KindTests/WhenEqualityIsCheckedByEquals.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.KindTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquals
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Kind? instance1, Kind? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals((object?)instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/KindTests/WhenEqualityIsCheckedByEquatable.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.KindTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquatable
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Kind? instance1, Kind? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals(instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/TypeTests/WhenEqualityIsCheckedByEquals.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.TypeTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquals
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Type? instance1, Type? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals((object?)instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/TypeTests/WhenEqualityIsCheckedByEquatable.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.TypeTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquatable
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Type? instance1, Type? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals(instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Semantics/DefinitionExtensions.GetProperty.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Semantics;
2 |
3 | using Microsoft.CodeAnalysis;
4 |
5 | internal static partial class DefinitionExtensions
6 | {
7 | public static IPropertySymbol GetProperty(this Definition definition, string name)
8 | {
9 | return definition
10 | .Symbol
11 | .GetMembers()
12 | .OfType()
13 | .Single(property => property.Name == name);
14 | }
15 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/GenericTests/WhenEqualityIsCheckedByEquatable.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.GenericTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquatable
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Generic? instance1, Generic? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals(instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/SubjectTests/WhenEqualityIsCheckedByEquatable.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.SubjectTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquatable
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Subject? instance1, Subject? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals(instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/GenericTests/WhenEqualityIsCheckedByEquals.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.GenericTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquals
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Generic? instance1, Generic? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals((object?)instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/PropertyTests/WhenEqualityIsCheckedByEquals.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.PropertyTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquals
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Property? instance1, Property? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals((object?)instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/PropertyTests/WhenEqualityIsCheckedByEquatable.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.PropertyTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquatable
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Property? instance1, Property? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals(instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Model/SubjectTests/WhenEqualityIsCheckedByEquals.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Model.SubjectTests;
2 |
3 | using Fluentify.Model;
4 |
5 | public sealed class WhenEqualityIsCheckedByEquals
6 | : WhenEqualityIsChecked
7 | {
8 | private protected override bool AreEqual(Subject? instance1, Subject? instance2)
9 | {
10 | if (instance1 is not null)
11 | {
12 | return instance1.Equals((object?)instance2);
13 | }
14 |
15 | return true;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Fluentify/Semantics/ITypeSymbolExtensions.IsNullable.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Semantics;
2 |
3 | using Microsoft.CodeAnalysis;
4 |
5 | internal static partial class ITypeSymbolExtensions
6 | {
7 | public static bool IsNullable(this ITypeSymbol type)
8 | {
9 | return type.NullableAnnotation == NullableAnnotation.Annotated
10 | || type.SpecialType == SpecialType.System_Nullable_T
11 | || type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T;
12 | }
13 | }
--------------------------------------------------------------------------------
/src/Fluentify.Tests/Snippets/Records.Unannotated.cs:
--------------------------------------------------------------------------------
1 | namespace Fluentify.Snippets;
2 |
3 | public static partial class Records
4 | {
5 | public const string UnannotatedContent = """
6 | namespace Fluentify.Records.Testing
7 | {
8 | using System.Collections.Generic;
9 |
10 | public sealed partial record Unannotated(int Age, string Name, IReadOnlyList