示例#1
0
 public void TestInit()
 {
     handlerResults     = null;
     permissableService = new Mock <IPermissableService>();
     context            = new PermissableSaveActionContext();
     handler            = (x) =>
     {
         handlerResults = x;
     };
     saveAction = new PermissableSaveAction(permissableService.Object, handler);
 }
示例#2
0
        public void TestConstructor_NullHandler()
        {
            var testInstance = new PermissableSaveAction(permissableService.Object, null);
            var serviceField = typeof(PermissableSaveAction).GetField("service", BindingFlags.Instance | BindingFlags.NonPublic);

            Assert.IsNotNull(serviceField);
            var serviceValue = serviceField.GetValue(testInstance);

            Assert.IsNotNull(serviceValue);

            var delegateField = typeof(PermissableSaveAction).GetField("addedPermissableEntityResultsDelegate", BindingFlags.Instance | BindingFlags.NonPublic);

            Assert.IsNotNull(delegateField);
            var delegateValue = delegateField.GetValue(testInstance);

            Assert.IsNotNull(delegateValue);
        }
示例#3
0
        public void TestConstructor()
        {
            Action <List <AddedPermissableEntityResult> > handler = (x) =>
            {
            };
            var testInstance = new PermissableSaveAction(permissableService.Object, handler);
            var serviceField = typeof(PermissableSaveAction).GetField("service", BindingFlags.Instance | BindingFlags.NonPublic);

            Assert.IsNotNull(serviceField);

            var serviceValue = serviceField.GetValue(testInstance);

            Assert.IsNotNull(serviceValue);

            var delegateField = typeof(PermissableSaveAction).GetField("addedPermissableEntityResultsDelegate", BindingFlags.Instance | BindingFlags.NonPublic);

            Assert.IsNotNull(delegateField);
            var delegateValue = delegateField.GetValue(testInstance);

            Assert.IsNotNull(delegateValue);
            Assert.IsTrue(Object.ReferenceEquals(handler, delegateValue));
        }