diff --git a/build/Build.cs b/build/Build.cs index 4c8423a..e808a5a 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,12 +1,4 @@ -using Nuke.Common; -using Nuke.Common.Execution; -using Nuke.Common.IO; -using Nuke.Common.ProjectModel; -using Nuke.Common.Tools.DotNet; -using Nuke.Common.Tools.OctoVersion; -using Nuke.Common.Utilities.Collections; -using static Nuke.Common.IO.FileSystemTasks; -using static Nuke.Common.Tools.DotNet.DotNetTasks; +using System; [UnsetVisualStudioEnvironmentVariables] class Build : NukeBuild @@ -16,15 +8,14 @@ class Build : NukeBuild [Solution] readonly Solution Solution; [Parameter("Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch.", - Name = "OCTOVERSION_CurrentBranch")] - readonly string BranchName; + Name = "OCTOVERSION_CurrentBranch")] + readonly string BranchName; - [Parameter("Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI.")] - readonly bool AutoDetectBranch = IsLocalBuild; + [Parameter("Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI.")] readonly bool AutoDetectBranch = IsLocalBuild; - [OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName), - AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")] - readonly OctoVersionInfo OctoVersionInfo; + [OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName), + AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")] + readonly OctoVersionInfo OctoVersionInfo; AbsolutePath SourceDirectory => RootDirectory / "source"; AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; diff --git a/source/Tests/AssertionExtensions.cs b/source/Tests/AssertionExtensions.cs index e0030d3..956f299 100644 --- a/source/Tests/AssertionExtensions.cs +++ b/source/Tests/AssertionExtensions.cs @@ -5,7 +5,6 @@ namespace Tests { public static class AssertionExtensions { - public static OclBodyAssertions Should(this OclBody? subject) - => new OclBodyAssertions(subject); + public static OclBodyAssertions Should(this OclBody? subject) => new(subject); } } \ No newline at end of file diff --git a/source/Tests/Converters/DefaultCollectionOclConverterFixture.cs b/source/Tests/Converters/DefaultCollectionOclConverterFixture.cs index b8f75cd..504f28b 100644 --- a/source/Tests/Converters/DefaultCollectionOclConverterFixture.cs +++ b/source/Tests/Converters/DefaultCollectionOclConverterFixture.cs @@ -11,7 +11,7 @@ public class DefaultCollectionOclConverterFixture { const string Value = "Daffy"; - readonly OclConversionContext context = new OclConversionContext(new OclSerializerOptions()); + readonly OclConversionContext context = new(new OclSerializerOptions()); [Test] public void FromElement_IEnumerableTargetWithCurrentAsNullReturnsAList() diff --git a/source/Tests/Converters/NameAttributeFixture.cs b/source/Tests/Converters/NameAttributeFixture.cs index 1bd431b..fcba56f 100644 --- a/source/Tests/Converters/NameAttributeFixture.cs +++ b/source/Tests/Converters/NameAttributeFixture.cs @@ -48,7 +48,7 @@ class DummyWithAttribute class DummyWithBlock { [OclName("AnotherName")] - public DummyWithAttribute BlockProperty { get; set; } = new DummyWithAttribute(); + public DummyWithAttribute BlockProperty { get; set; } = new(); } } } \ No newline at end of file diff --git a/source/Tests/FromOclDoc/FromOclDocumentDefaultBehaviourFixture.cs b/source/Tests/FromOclDoc/FromOclDocumentDefaultBehaviourFixture.cs index bbb48a4..dd62111 100644 --- a/source/Tests/FromOclDoc/FromOclDocumentDefaultBehaviourFixture.cs +++ b/source/Tests/FromOclDoc/FromOclDocumentDefaultBehaviourFixture.cs @@ -210,7 +210,7 @@ public void CollectionSingleItem() { Passengers = new List { - new Person + new() { Name = "Bob" } } }); @@ -241,9 +241,9 @@ public void CollectionMultipleItems() { Passengers = new List { - new Person + new() { Name = "Bob" }, - new Person + new() { Name = "George" } } }); @@ -257,7 +257,7 @@ public void ExceptionIsThrownIfPropertyDoesNotExist() new OclAttribute("Wings", 1) }; - Action action = () => + var action = () => { var context = new OclConversionContext(new OclSerializerOptions() ?? new OclSerializerOptions()); var result = context.FromElement(typeof(Car), document, null); @@ -278,7 +278,7 @@ public void ExceptionIsThrownIfPropertyCantBeSet() new OclAttribute("ReadOnly", 1) }; - Action action = () => + var action = () => { var context = new OclConversionContext(new OclSerializerOptions() ?? new OclSerializerOptions()); var result = context.FromElement(typeof(Car), document, null); @@ -322,7 +322,7 @@ class Car public int ReadOnly { get; } = 1; public Person? Driver { get; set; } public List? Passengers { get; set; } - public List ReadOnlyPassengers { get; } = new List(); + public List ReadOnlyPassengers { get; } = new(); public CarType Type { get; set; } public Dictionary? StringDictionary { get; set; } public Dictionary? ObjectDictionary { get; set; } diff --git a/source/Tests/RealLifeScenario/Entities/DeploymentAction.cs b/source/Tests/RealLifeScenario/Entities/DeploymentAction.cs index 3a1e613..17690e3 100644 --- a/source/Tests/RealLifeScenario/Entities/DeploymentAction.cs +++ b/source/Tests/RealLifeScenario/Entities/DeploymentAction.cs @@ -40,23 +40,23 @@ public DeploymentAction(string name, string actionType) public bool CanBeUsedForProjectVersioning => true; [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)] - public ReferenceCollection Environments { get; } = new ReferenceCollection(); + public ReferenceCollection Environments { get; } = new(); [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)] - public ReferenceCollection ExcludedEnvironments { get; } = new ReferenceCollection(); + public ReferenceCollection ExcludedEnvironments { get; } = new(); [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)] - public ReferenceCollection Channels { get; } = new ReferenceCollection(); + public ReferenceCollection Channels { get; } = new(); [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)] - public ReferenceCollection TenantTags { get; } = new ReferenceCollection(); + public ReferenceCollection TenantTags { get; } = new(); [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)] - public PackageReferenceCollection Packages { get; } = new PackageReferenceCollection(); + public PackageReferenceCollection Packages { get; } = new(); public DeploymentActionCondition Condition { get; set; } [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)] - public PropertiesDictionary Properties { get; } = new PropertiesDictionary(); + public PropertiesDictionary Properties { get; } = new(); } } \ No newline at end of file diff --git a/source/Tests/RealLifeScenario/Entities/DeploymentStep.cs b/source/Tests/RealLifeScenario/Entities/DeploymentStep.cs index 188c151..0c5f17f 100644 --- a/source/Tests/RealLifeScenario/Entities/DeploymentStep.cs +++ b/source/Tests/RealLifeScenario/Entities/DeploymentStep.cs @@ -20,7 +20,7 @@ public DeploymentStep(string name) public DeploymentStepPackageRequirement PackageRequirement { get; set; } [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)] - public List Actions { get; } = new List(); + public List Actions { get; } = new(); [JsonIgnore] public IEnumerable InheritedPropertiesForActions @@ -29,6 +29,6 @@ public IEnumerable InheritedPropertiesForActions } [JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)] - public PropertiesDictionary Properties { get; } = new PropertiesDictionary(); + public PropertiesDictionary Properties { get; } = new(); } } \ No newline at end of file diff --git a/source/Tests/RealLifeScenario/Entities/VcsRunbook.cs b/source/Tests/RealLifeScenario/Entities/VcsRunbook.cs index d5fc555..156554d 100644 --- a/source/Tests/RealLifeScenario/Entities/VcsRunbook.cs +++ b/source/Tests/RealLifeScenario/Entities/VcsRunbook.cs @@ -16,14 +16,14 @@ public VcsRunbook(string name) public TenantedDeploymentMode MultiTenancyMode { get; set; } - public ProjectConnectivityPolicy ConnectivityPolicy { get; set; } = new ProjectConnectivityPolicy + public ProjectConnectivityPolicy ConnectivityPolicy { get; set; } = new() { AllowDeploymentsToNoTargets = true }; public RunbookEnvironmentScope EnvironmentScope { get; set; } - public ReferenceCollection Environments { get; } = new ReferenceCollection(); + public ReferenceCollection Environments { get; } = new(); public GuidedFailureMode DefaultGuidedFailureMode { get; set; } } diff --git a/source/Tests/ToOclDoc/ToOclDocConverterFixture.cs b/source/Tests/ToOclDoc/ToOclDocConverterFixture.cs index 3a36e78..2390887 100644 --- a/source/Tests/ToOclDoc/ToOclDocConverterFixture.cs +++ b/source/Tests/ToOclDoc/ToOclDocConverterFixture.cs @@ -65,8 +65,7 @@ public bool CanConvert(Type type) public IEnumerable ToElements(OclConversionContext context, PropertyInfo? propertyInfo, object value) => throw new NotImplementedException(); - public OclDocument ToDocument(OclConversionContext context, object obj) - => new OclDocument(new[] { new OclAttribute("Fake", null) }); + public OclDocument ToDocument(OclConversionContext context, object obj) => new(new[] { new OclAttribute("Fake", null) }); public object? FromElement(OclConversionContext context, Type type, IOclElement element, object? currentValue) => throw new NotImplementedException(); diff --git a/source/Tests/ToOclDoc/ToOclDocDefaultBehaviourFixture.cs b/source/Tests/ToOclDoc/ToOclDocDefaultBehaviourFixture.cs index 2619bb7..68013fa 100644 --- a/source/Tests/ToOclDoc/ToOclDocDefaultBehaviourFixture.cs +++ b/source/Tests/ToOclDoc/ToOclDocDefaultBehaviourFixture.cs @@ -32,7 +32,7 @@ public void ListOfComplexTypesProperty() var data = new { Cars = new List - { new Car(), new Car() } + { new(), new() } }; var result = new OclSerializer().ToOclDocument(data); diff --git a/source/Tests/ToString/OclWriterFixture.cs b/source/Tests/ToString/OclWriterFixture.cs index 3a565c8..bcf1dfb 100644 --- a/source/Tests/ToString/OclWriterFixture.cs +++ b/source/Tests/ToString/OclWriterFixture.cs @@ -13,8 +13,7 @@ public class OclWriterFixture { static IEnumerable WriteAttributeDataSource() { - TestCaseData CreateCase(string name, object? value, string expected) - => new TestCaseData(value, expected) { TestName = "WriteAttribute value: " + name }; + TestCaseData CreateCase(string name, object? value, string expected) => new(value, expected) { TestName = "WriteAttribute value: " + name }; yield return CreateCase("null", null, "null"); yield return CreateCase("bool", false, "false");