Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        public void Setup()
        {
            TestableDataPortal.Setup();

            ConfigurationManager.AppSettings["CslaAuthorizationProvider"] =
                "Csla.Testing.Business.DataPortal.AuthorizeDataPortalStub, Csla.Testing.Business";
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public void IfCslaAuthorizationProviderAppSetting_HoldsEmptyString_ThenUse_NullAuthorizationProvider()
        {
            ConfigurationManager.AppSettings["EmptyTypeName"] = string.Empty;
            var dp = new TestableDataPortal("EmptyTypeName");

            Assert.IsTrue(dp.NullAuthorizerUsed);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public void DataPortal_Delete_Calls_IAuthorizeDataPortal_Authorize_WithCorrectParameters()
        {
            var dp = new TestableDataPortal();

            dp.Delete(typeof(TestBO), null, 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.Delete, result.ClientRequest.Operation);
        }
Exemplo n.º 7
0
 public void IfCslaAuthorizationProviderAppSetting_HoldsInvalidType_ThenThrow_TypeLoadException()
 {
     ConfigurationManager.AppSettings["InvalidTypeName"] = "InvalidTypeName";
     var dp = new TestableDataPortal("InvalidTypeName");
 }
Exemplo n.º 8
0
        public void IfCslaAuthorizationProviderAppSetting_DoesNotExist_ThenUse_NullAuthorizationProvider()
        {
            var dp = new TestableDataPortal("NonExistentAppSetting");

            Assert.IsTrue(dp.NullAuthorizerUsed);
        }