public void IfAuthProviderTypeImplements_IAuthorizeDataPortal_Then_authorizerFieldShouldBeAnInstanceOfThatType()
    {
      Type validAuthProvider = typeof (AuthorizeDataPortalStub);
      var dp = new TestableDataPortal(validAuthProvider);

      Assert.IsTrue(validAuthProvider == dp.AuthProviderType);//_authorizer field is set to correct value;
    }
Beispiel #2
0
        public void DataPortal_Update_Calls_IAuthorizeDataPortal_Authorize_WithCorrectParameters()
        {
            var dp = new TestableDataPortal();
              dp.Update(new TestBO(), new DataPortalContext(null, false), true);

              var result = (AuthorizeDataPortalStub)dp.AuthProvider;//This comes from App.Config

              Assert.AreEqual(typeof(TestBO), result.ClientRequest.ObjectType);
              Assert.AreEqual(DataPortalOperations.Update, result.ClientRequest.Operation);
        }
Beispiel #3
0
        public void IfAuthorizationProvider_SetInConfigFile_DataPortal_Instantiates_AuthorizationProviderType()
        {
            //Following is set in App.Config
              //ConfigurationManager.AppSettings["CslaAuthorizationProvider"] = "Csla.Test.Silverlight.DataPortal.AuthorizeDataPortalStub, Csla.Test";
              TestableDataPortal dp = new TestableDataPortal();

              Assert.IsTrue(typeof(AuthorizeDataPortalStub) == dp.AuthProviderType);
        }
Beispiel #4
0
        public void IfCslaAuthorizationProviderAppSetting_HoldsValidType_Then_authorizerFieldShouldHoldThatType()
        {
            ConfigurationManager.AppSettings["ValidTypeNameSetting"] = "Csla.Testing.Business.DataPortal.AuthorizeDataPortalStub, Csla.Testing.Business";
              var dp = new TestableDataPortal("ValidTypeNameSetting");

              Assert.IsTrue(typeof(AuthorizeDataPortalStub)==dp.AuthProviderType);
        }
Beispiel #5
0
 public void IfCslaAuthorizationProviderAppSetting_HoldsInvalidType_ThenThrow_TypeLoadException()
 {
     ConfigurationManager.AppSettings["InvalidTypeName"] ="InvalidTypeName";
       var dp = new TestableDataPortal("InvalidTypeName");
 }
Beispiel #6
0
        public void IfCslaAuthorizationProviderAppSetting_HoldsEmptyString_ThenUse_NullAuthorizationProvider()
        {
            ConfigurationManager.AppSettings["EmptyTypeName"] = string.Empty;
              var dp = new TestableDataPortal("EmptyTypeName");

              Assert.IsTrue(dp.NullAuthorizerUsed);
        }
Beispiel #7
0
 public void IfCslaAuthorizationProviderAppSetting_DoesNotExist_ThenUse_NullAuthorizationProvider()
 {
     var dp = new TestableDataPortal("NonExistentAppSetting");
       Assert.IsTrue(dp.NullAuthorizerUsed);
 }