Completed
Last Updated: 22 Jun 2022 13:47 by ADMIN
Ivo
Created on: 04 May 2022 09:02
Type: Bug Report
0
R3.2021 breaking change: unable to mock CultureInfo

Using the mentioned (or later) product version, the following simple test fails (throws NullReferenceException):

[TestMethod]
public void TestMethod()
{
    var cultureInfo = Mock.Create<CultureInfo>();
    var thisThrowsAnException = cultureInfo.Name;
}

One of the possible workarounds is to create a mock like this:

readonly string cultureName = CultureInfo.InvariantCulture.Name;
...
var cultureInfo = Mock.Create(() => new CultureInfo(cultureName));

1 comment
ADMIN
Mihail
Posted on: 22 Jun 2022 13:47

The issue was resolved and the fix is now available with R2 SP1 2022 version 2022.2.621.1.

Regards,
Mihail
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.