MyTested.AspNetCore.Mvc icon indicating copy to clipboard operation
MyTested.AspNetCore.Mvc copied to clipboard

Writing test for .net 5 project using .net 6 runtime

Open grinay opened this issue 2 years ago • 9 comments

It's always hard to write integrations tests and eventually, I found your project. This is an amazing solution. Thanks for your efforts on this. I setting up tests for a new project to which I sign up. And trying to use it. However when I execute test it throughs the exception "This version of MyTested.AspNetCore.Mvc only supports ASP.NET Core 5.0 applications but the 6.0.0 web framework was" The project is written with .net 5 and .net 6 able to run it without any issue. I can set up .net 5 but I'm already moved to new apple silicon and .net 5 works very slow on m1. Is there any way to disable runtime framework checks?

grinay avatar Nov 12 '21 18:11 grinay

@ivaylokenov would it be this kind of code appropriate?

 public static class TestFramework
    {
        public const string TestFrameworkName = "MyTested.AspNetCore.Mvc";
        public const string ReleaseDate = "2021-07-01";
        public const string VersionPrefix = "5.0";

        internal static void EnsureCorrectVersion(DependencyContext dependencyContext)
        {
            if (!dependencyContext.Target.Framework.EndsWith(VersionPrefix))
            {
                throw new InvalidOperationException(
                    $"This version of {TestFrameworkName} only supports target framework ASP.NET Core {VersionPrefix}");
            }
        }
    }

grinay avatar Nov 13 '21 17:11 grinay

@grinay I will publish packages for .NET 6 in a week. Stay tuned!

ivaylokenov avatar Nov 24 '21 14:11 ivaylokenov

@ivaylokenov thanks.)

grinay avatar Nov 25 '21 17:11 grinay

Hi @ivaylokenov , first of all: great work on this super useful package that I have used in several projects already. I was wondering when the version for .NET 6 will be published since we're migrating to it and of course would like to migrate the unit tests for our controllers as well without rework ;) Thanks in advance!

arjanh76 avatar Dec 10 '21 09:12 arjanh76

Hi @ivaylokenov any update on .net 6 version?

grinay avatar Dec 30 '21 21:12 grinay

@grinay I will publish packages for .NET 6 in a week. Stay tuned!

Any update on this? Can we expect a .net 6 version in the near future?

arjanh76 avatar Feb 10 '22 16:02 arjanh76

Hi Ivo, can we expect dotnet 6 soon, if money is needed we can also provide some? @ivaylokenov

botrot avatar Mar 11 '22 14:03 botrot

@ivaylokenov Yeah, it will be highly appreciated (.NET 6)

Sinkarq avatar Apr 04 '22 14:04 Sinkarq

+1

negberts avatar May 20 '22 14:05 negberts