License not visible when writing a test subject.

Posted by: cpopescu on 5 May 2021, 9:06 am EST

  • Posted 5 May 2021, 9:06 am EST

    I wrote the following test in order, using bUnit to start improving the coverage:

    public class C1_AlertTest : TestContext
    public void SampleTest()
    using var ctx = new TestContext();
    var cut = RenderComponent<C1_Alert>(
    parameters => parameters.Add(
    p=> p.WarningMessage, "WarningTest"

    var warningMessageDiv = cut.Find("WarningMessage");

    var str = warningMessageDiv.Children.ToString();
    Assert.Equal("WarningTest", str);

    This compiles perfectly fine, however, unlike the actual codebase (which runs perfectly) I am not able to write tests, because I run into the following error:

    BlazorDemoAppTest.C1_AlertTest.SampleTest [FAIL]
    [ 00:00:00.98] System.UnauthorizedAccessException : The ComponentOne license key is invalid or missing.

    Am I missing a necessary step to allow tests to work. I've already tried adding the ComponentOne NuGet under the test project, but the error is still there.
  • Replied 5 May 2021, 6:36 pm EST

    We are sorry for the inconvenience, we are able to replicate the issue and we are investigating this issue with the development team with the internal tracking id C1-3150.

    We will let you know as we get an update on this.

    Manish Gupta
  • Marked as Answer

    Replied 12 July 2021, 5:29 pm EST

    Thank you for your patience. To pass the UNIT test case for BlazorUnit Test, we need to generate the gclicx file manually with the following steps:

    Open the command prompt from "C1BlazorCtrlTest\bin\Debug\net5.0" location

    Run the following command to generate the gclicx file
    "C:\ProgramData\GrapeCity\gclm\gclm.exe" "331cf6cd-b73c-429f-ba79-fa2f85eebd68" -lc ./.gclicx "testhost.C1BlazorCtrlTest"

    Copy the new generated .gclicx to BlazorBunitTest\C1BlazorCtrlTest (csproj location)

    Open BlazorBunitTest.sln, include the .gclicx file into project as EmbeddedResource.

    Rebuild and re-run unit test

    Here is the updated project.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels