I have a problem running the Kentico UnitTests. I get the following error:
NUnit Adapter 3.6.1.0: Test execution started Running selected tests in xxxxxx.dll NUnit3TestExecutor converted 1 of 1 NUnit test cases
SetUp failed for test fixture xxxxxx_tests.ContentCreator_test
System.NullReferenceException : Der Objektverweis wurde nicht auf eine
Objektinstanz festgelegt. bei
CMS.Tests.TestsCategoryCheck.GetCategoriesFromConfig(String keyName)
bei CMS.Tests.TestsCategoryCheck.@.cctor>b__8() bei
System.Lazy1.CreateValue() bei System.Lazy1.LazyInitValue()
bei System.Lazy`1.get_Value() bei
CMS.Tests.TestsCategoryCheck.CheckAllTestsCategories(Type type) bei
CMS.Tests.AutomatedTests.InitFixtureBase()How can I fix it ?I installed the Kentico.Library.Tests and wrote this test:using CMS.Membership;
using CMS.Tests;
using NUnit.Framework;
[TestFixture]
public class MyUnitTests : UnitTests
{
[SetUp]
public void MyUnitTestSetUp()
{
// Prepares faked data for the UserInfoProvider
Fake@UserInfo, UserInfoProvider@().WithData(
new UserInfo
{
UserID = 123,
UserName = "FakeUser",
UserNickName = "FakeUser"
});
}
[Test]
public void MyTest()
{
// Calls a UserInfoProvider method to get user data
var users = UserInfoProvider.GetUsers();
}
}
↧