BDTest icon indicating copy to clipboard operation
BDTest copied to clipboard

Please strongly name any BDTest asseblies so BDTest can be used in Signed Test Projects

Open AbsAlnaffakh opened this issue 2 years ago • 2 comments

I am unable to use BDTest within Signed test projects as BDTest assemblies are not strongly named.

The below exception is thrown upon test execution:

System.IO.FileLoadException : Could not load file or assembly 'BDTest, Version=2.3.27.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Intiaiting code is a as simple as:

[Test]
public void TestPass()
{
    new BDTestBuilder()
        .When(() => DoNothing())
        .Then(() => DoNothing())
        .BDTest();
}

public void DoNothing()
{ 

}

Please note that not using the BDTestBuilder and inheriting from a base test class results in the test not running at all and no errors being produced

My test projects have to be strongly named as they require visibility of internal members of their production counterparts (the production counterparts are signed hence why the test project is signed)

https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/strong-naming

https://learn.microsoft.com/en-us/dotnet/standard/assembly/sign-strong-name

AbsAlnaffakh avatar Feb 08 '24 11:02 AbsAlnaffakh

Required changes can be found in this PR

AbsAlnaffakh avatar Feb 08 '24 14:02 AbsAlnaffakh

Thanks @AbsAlnaffakh . I've approved and released a new version. Could you let me know if it works for you?

thomhurst avatar Feb 10 '24 00:02 thomhurst

Thanks @thomhurst, Yes the tests now execute within the signed test project and the compiler no longer produces a warning that complains about the the BDTest assemblies not being signed.

AbsAlnaffakh avatar Feb 10 '24 13:02 AbsAlnaffakh