0
我目前正在学习如何在Silverlight RIA项目中测试我的方法。我有一些用户被授权的方法。我虽然可以通过创建一个模拟授权服务来解决这个问题。然后让用户以这种方式获得授权,但似乎我从代码中引用了null参考,因为它调用了我测试的代码所源自的项目中的授权服务,并在createdefaultuser方法中获取了nullreference,否则会在mockauthorizationservice中手动重写。授权服务导致单元测试失败
我该如何解决这个问题? 我mockauthorization有这个命名空间/类definitionnamespace
Notlr.Test
{
public class MockAuthentication : AuthenticationService
{
}
}
我的地头的AuthenticationService看起来是这样的:
namespace Notlr.Web
{
using System;
using System.ServiceModel.DomainServices.Hosting;
using System.ServiceModel.DomainServices.Server.ApplicationServices;
using System.Web.Security;
/// <summary>
/// RIA Services DomainService responsible for authenticating users when
/// they try to log on to the application.
///
/// Most of the functionality is already provided by the base class
/// AuthenticationBase
/// </summary>
[EnableClientAccess]
public class AuthenticationService : AuthenticationBase<User>
{
}
}
我试图编辑我的帖子,我希望我发布的代码是您请求的,请引导我沿着正确的路径。我的测试应该在Notlr.Test? – Jakob 2010-11-04 20:46:27