mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Fix warnings in tests
This commit is contained in:
@@ -43,7 +43,7 @@ namespace CliFx.Tests
|
|||||||
.UseVersionText("test")
|
.UseVersionText("test")
|
||||||
.UseDescription("test")
|
.UseDescription("test")
|
||||||
.UseConsole(new VirtualConsole(Stream.Null))
|
.UseConsole(new VirtualConsole(Stream.Null))
|
||||||
.UseTypeActivator(Activator.CreateInstance)
|
.UseTypeActivator(Activator.CreateInstance!)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@@ -212,7 +212,7 @@ namespace CliFx.Tests
|
|||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
new CommandParameterSchema(
|
new CommandParameterSchema(
|
||||||
typeof(HiddenPropertiesCommand).GetProperty(nameof(HiddenPropertiesCommand.Parameter)),
|
typeof(HiddenPropertiesCommand).GetProperty(nameof(HiddenPropertiesCommand.Parameter))!,
|
||||||
13,
|
13,
|
||||||
"param",
|
"param",
|
||||||
"Param description")
|
"Param description")
|
||||||
@@ -220,7 +220,7 @@ namespace CliFx.Tests
|
|||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
new CommandOptionSchema(
|
new CommandOptionSchema(
|
||||||
typeof(HiddenPropertiesCommand).GetProperty(nameof(HiddenPropertiesCommand.Option)),
|
typeof(HiddenPropertiesCommand).GetProperty(nameof(HiddenPropertiesCommand.Option))!,
|
||||||
"option",
|
"option",
|
||||||
'o',
|
'o',
|
||||||
"ENV",
|
"ENV",
|
||||||
|
|||||||
@@ -17,20 +17,14 @@ namespace CliFx.Tests
|
|||||||
{
|
{
|
||||||
public string Value { get; }
|
public string Value { get; }
|
||||||
|
|
||||||
public StringConstructable(string value)
|
public StringConstructable(string value) => Value = value;
|
||||||
{
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StringParseable
|
private class StringParseable
|
||||||
{
|
{
|
||||||
public string Value { get; }
|
public string Value { get; }
|
||||||
|
|
||||||
private StringParseable(string value)
|
private StringParseable(string value) => Value = value;
|
||||||
{
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static StringParseable Parse(string value) => new StringParseable(value);
|
public static StringParseable Parse(string value) => new StringParseable(value);
|
||||||
}
|
}
|
||||||
@@ -39,10 +33,7 @@ namespace CliFx.Tests
|
|||||||
{
|
{
|
||||||
public string Value { get; }
|
public string Value { get; }
|
||||||
|
|
||||||
private StringParseableWithFormatProvider(string value)
|
private StringParseableWithFormatProvider(string value) => Value = value;
|
||||||
{
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static StringParseableWithFormatProvider Parse(string value, IFormatProvider formatProvider) =>
|
public static StringParseableWithFormatProvider Parse(string value, IFormatProvider formatProvider) =>
|
||||||
new StringParseableWithFormatProvider(value + " " + formatProvider);
|
new StringParseableWithFormatProvider(value + " " + formatProvider);
|
||||||
@@ -54,9 +45,7 @@ namespace CliFx.Tests
|
|||||||
|
|
||||||
public class CustomEnumerable<T> : IEnumerable<T>
|
public class CustomEnumerable<T> : IEnumerable<T>
|
||||||
{
|
{
|
||||||
private readonly T[] _arr = new T[0];
|
public IEnumerator<T> GetEnumerator() => ((IEnumerable<T>) Array.Empty<T>()).GetEnumerator();
|
||||||
|
|
||||||
public IEnumerator<T> GetEnumerator() => ((IEnumerable<T>) _arr).GetEnumerator();
|
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CliFx.Attributes;
|
using CliFx.Attributes;
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ namespace CliFx.Tests
|
|||||||
private class ConcatCommand : ICommand
|
private class ConcatCommand : ICommand
|
||||||
{
|
{
|
||||||
[CommandOption('i', IsRequired = true, Description = "Input strings.")]
|
[CommandOption('i', IsRequired = true, Description = "Input strings.")]
|
||||||
public IReadOnlyList<string> Inputs { get; set; }
|
public IReadOnlyList<string> Inputs { get; set; } = Array.Empty<string>();
|
||||||
|
|
||||||
[CommandOption('s', Description = "String separator.")]
|
[CommandOption('s', Description = "String separator.")]
|
||||||
public string Separator { get; set; } = "";
|
public string Separator { get; set; } = "";
|
||||||
@@ -36,10 +37,10 @@ namespace CliFx.Tests
|
|||||||
private class DivideCommand : ICommand
|
private class DivideCommand : ICommand
|
||||||
{
|
{
|
||||||
[CommandOption("dividend", 'D', IsRequired = true, Description = "The number to divide.")]
|
[CommandOption("dividend", 'D', IsRequired = true, Description = "The number to divide.")]
|
||||||
public double Dividend { get; set; }
|
public double Dividend { get; set; } = 0;
|
||||||
|
|
||||||
[CommandOption("divisor", 'd', IsRequired = true, Description = "The number to divide by.")]
|
[CommandOption("divisor", 'd', IsRequired = true, Description = "The number to divide by.")]
|
||||||
public double Divisor { get; set; }
|
public double Divisor { get; set; } = 0;
|
||||||
|
|
||||||
public ValueTask ExecuteAsync(IConsole console)
|
public ValueTask ExecuteAsync(IConsole console)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user