Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@

[DataDiscoverer("Bss.Testing.Xunit.Sdk.ServiceProviderMemberDataDiscoverer", "Bss.Testing.Xunit")]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class ServiceProviderMemberDataAttribute(string methodOrPropertyName) : DataAttribute

Check warning on line 14 in xunit/src/Bss.Testing.Xunit/Sdk/ServiceProviderMemberDataAttribute.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'MemberType' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 14 in xunit/src/Bss.Testing.Xunit/Sdk/ServiceProviderMemberDataAttribute.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'MemberType' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
{
public Type MemberType { get; set; }

string MemberName { get; set; } = methodOrPropertyName;

public override IEnumerable<object[]> GetData(MethodInfo testMethod) => null;

Check warning on line 20 in xunit/src/Bss.Testing.Xunit/Sdk/ServiceProviderMemberDataAttribute.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.

Check warning on line 20 in xunit/src/Bss.Testing.Xunit/Sdk/ServiceProviderMemberDataAttribute.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.

public IEnumerable<object[]> GetData(MethodInfo testMethod, IServiceProvider serviceProvider)
{
var type = this.MemberType ?? testMethod.DeclaringType;
var type = this.MemberType ?? testMethod.ReflectedType;
var accessor = this.GetMethodAccessor(type, serviceProvider)

Check warning on line 25 in xunit/src/Bss.Testing.Xunit/Sdk/ServiceProviderMemberDataAttribute.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'type' in 'Func<object?>? ServiceProviderMemberDataAttribute.GetMethodAccessor(Type type, IServiceProvider serviceProvider)'.

Check warning on line 25 in xunit/src/Bss.Testing.Xunit/Sdk/ServiceProviderMemberDataAttribute.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'type' in 'Func<object?>? ServiceProviderMemberDataAttribute.GetMethodAccessor(Type type, IServiceProvider serviceProvider)'.
?? this.GetPropertyAccessor(type, serviceProvider);

if (accessor == null)
Expand All @@ -39,7 +39,7 @@
var obj = accessor();
if (obj == null)
{
return null;

Check warning on line 42 in xunit/src/Bss.Testing.Xunit/Sdk/ServiceProviderMemberDataAttribute.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.
}

if (obj is not IEnumerable dataItems)
Expand All @@ -47,7 +47,7 @@
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Method/property {0} on {1} did not return IEnumerable", this.MemberName, type?.FullName));
}

return dataItems.Cast<object>().Select(item => this.ConvertDataItem(testMethod, item));

Check warning on line 50 in xunit/src/Bss.Testing.Xunit/Sdk/ServiceProviderMemberDataAttribute.cs

View workflow job for this annotation

GitHub Actions / build

Nullability of reference types in value of type 'IEnumerable<object[]?>' doesn't match target type 'IEnumerable<object[]>'.
}

private Func<object?>? GetMethodAccessor(Type type, IServiceProvider serviceProvider)
Expand Down
6 changes: 3 additions & 3 deletions xunit/src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[assembly: AssemblyCompany("Luxoft")]
[assembly: AssemblyCopyright("Copyright © Luxoft 2024")]

[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1.0")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand Down
Loading