Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add necessary packages to run dotnet test I mean the test still fails but that is a problem with my city code :yay: wyoming-4730637:~/wyoming{main}$ dotnet test Determining projects to restore... All projects are up-to-date for restore. myapp -> /home/user/wyoming/bin/Debug/net8.0/myapp.dll Test run for /home/user/wyoming/bin/Debug/net8.0/myapp.dll (.NETCoreApp,Version=v8.0) Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64) Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... A total of 1 test files matched the specified pattern. Testhost process for source(s) '/home/user/wyoming/bin/Debug/net8.0/myapp.dll' exited with error: Error: An assembly specified in the application dependencies manifest (testhost.deps.json) was not found: package: 'Newtonsoft.Json', version: '13.0.1' path: 'lib/netstandard2.0/Newtonsoft.Json.dll' . Please check the diagnostic logs for more information. Test Run Aborted. wyoming-4730637:~/wyoming{main}$ dotnet test Determining projects to restore... Restored /home/user/wyoming/myapp.csproj (in 1.31 sec). myapp -> /home/user/wyoming/bin/Debug/net8.0/myapp.dll Test run for /home/user/wyoming/bin/Debug/net8.0/myapp.dll (.NETCoreApp,Version=v8.0) Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64) Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... A total of 1 test files matched the specified pattern. Testhost process for source(s) '/home/user/wyoming/bin/Debug/net8.0/myapp.dll' exited with error: Error: An assembly specified in the application dependencies manifest (testhost.deps.json) was not found: package: 'NuGet.Frameworks', version: '6.5.0' path: 'lib/netstandard2.0/NuGet.Frameworks.dll' . Please check the diagnostic logs for more information. Test Run Aborted. wyoming-4730637:~/wyoming{main}$ dotnet test Determining projects to restore... All projects are up-to-date for restore. /home/user/.nuget/packages/microsoft.net.test.sdk/17.10.0/build/netcoreapp3.1/Microsoft.NET.Test.Sdk.Program.cs(4,41): warning CS7022: The entry point of the program is global code; ignoring 'AutoGeneratedProgram.Main(string[])' entry point. [/home/user/wyoming/myapp.csproj] myapp -> /home/user/wyoming/bin/Debug/net8.0/myapp.dll Test run for /home/user/wyoming/bin/Debug/net8.0/myapp.dll (.NETCoreApp,Version=v8.0) Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64) Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... A total of 1 test files matched the specified pattern. [xUnit.net 00:00:00.75] AnalyticsWebApi.AnalyticsRepositoryTests.SaveAnalyticsData_ValidData_ReturnsSuccess [FAIL] Failed AnalyticsWebApi.AnalyticsRepositoryTests.SaveAnalyticsData_ValidData_ReturnsSuccess [254 ms] Error Message: NSubstitute.Exceptions.RedundantArgumentMatcherException : Some argument specifications (e.g. Arg.Is, Arg.Any) were left over after the last call. This is often caused by using an argument spec with a call to a member NSubstitute does not handle (such as a non-virtual member or a call to an instance which is not a substitute), or for a purpose other than specifying a call (such as using an arg spec as a return value). For example: var sub = Substitute.For<SomeClass>(); var realType = new MyRealType(sub); // INCORRECT, arg spec used on realType, not a substitute: realType.SomeMethod(Arg.Any<int>()).Returns(2); // INCORRECT, arg spec used as a return value, not to specify a call: sub.VirtualMethod(2).Returns(Arg.Any<int>()); // INCORRECT, arg spec used with a non-virtual method: sub.NonVirtualMethod(Arg.Any<int>()).Returns(2); // CORRECT, arg spec used to specify virtual call on a substitute: sub.VirtualMethod(Arg.Any<int>()).Returns(2); To fix this make sure you only use argument specifications with calls to substitutes. If your substitute is a class, make sure the member is virtual. Another possible cause is that the argument spec type does not match the actual argument type, but code compiles due to an implicit cast. For example, Arg.Any<int>() was used, but Arg.Any<double>() was required. NOTE: the cause of this exception can be in a previously executed test. Use the diagnostics below to see the types of any redundant arg specs, then work out where they are being created. Diagnostic information: Remaining (non-bound) argument specifications: any Object All argument specifications: any String any Object Stack Trace: at NSubstitute.Core.Arguments.ArgumentSpecificationsFactory.Create(IList`1 argumentSpecs, Object[] arguments, IParameterInfo[] parameterInfos, MethodInfo methodInfo, MatchArgs matchArgs) at NSubstitute.Core.CallSpecificationFactory.CreateFrom(ICall call, MatchArgs matchArgs) at NSubstitute.Routing.Handlers.RecordCallSpecificationHandler.Handle(ICall call) at NSubstitute.Routing.Route.Handle(ICall call) at NSubstitute.Core.CallRouter.Route(ICall call) at NSubstitute.Proxies.CastleDynamicProxy.CastleForwardingInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at NSubstitute.Proxies.CastleDynamicProxy.ProxyIdInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.ObjectProxy_1.set_CommandText(String value) at Dapper.CommandDefinition.SetupCommand(IDbConnection cnn, Action`2 paramReader) in /_/Dapper/CommandDefinition.cs:line 134 at Dapper.SqlMapper.TrySetupAsyncCommand(CommandDefinition command, IDbConnection cnn, Action`2 paramReader) in /_/Dapper/SqlMapper.Async.cs:line 412 at Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition command, Object param) in /_/Dapper/SqlMapper.Async.cs:line 658 at NSubstitute.SubstituteExtensions.ReThrowOnNSubstituteFault[T](Task`1 task) at NSubstitute.SubstituteExtensions.Returns[T](Task`1 value, T returnThis, T[] returnThese) at AnalyticsWebApi.AnalyticsRepositoryTests.SaveAnalyticsData_ValidData_ReturnsSuccess() in /home/user/wyoming/Tests/AnalyticsRepositoryTests.cs:line 24 --- End of stack trace from previous location --- Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: < 1 ms - myapp.dll (net8.0) wyoming-4730637:~/wyoming{main}$ see dotnet/sdk#38473 for a fuller treatment
- Loading branch information