示例#1
0
 public virtual void AddNotifier(INotifier notifier)
 {
     if (Sound == null)
     {
         if (notifier is ISoundNotifier)
         {
             TriggerEntity.HasSound = true;
             Sound = (SoundNotifier)notifier;
             return;
         }
     }
     if (Popup == null)
     {
         if (notifier is IPopupNotifier)
         {
             TriggerEntity.HasPopup = true;
             Popup = (PopupNotifier)notifier;
             return;
         }
     }
     throw new TriggerException(
               string.Format(
                   "could not add notifier of type {0}, either this type exists in trigger or is not supported",
                   notifier.GetType()));
 }
示例#2
0
        public void Resolve_Type()
        {
            //Checing It the Container is REsolving the Type

            //Arrange
            _container.Register <INotifier, Notifier>();

            //Action
            INotifier instance = _container.Resolve <INotifier>();

            //Assert
            Assert.IsNotNull(instance);
            Assert.IsTrue(instance.GetType() == typeof(Notifier));
        }
示例#3
0
 public virtual void RemoveNotifier(INotifier notifier)
 {
     if (notifier is ISoundNotifier)
     {
         Sound = null;
         return;
     }
     if (notifier is IPopupNotifier)
     {
         Popup = null;
         return;
     }
     if (notifier is IMessageNotifier)
     {
         Message = null;
         return;
     }
     throw new TriggerException("Removal of notifier failed, argument exact type: " + notifier.GetType());
 }
示例#4
0
 public virtual void AddNotifier(INotifier notifier)
 {
     if (Sound == null)
     {
         if (notifier is ISoundNotifier)
         {
             Sound = notifier;
             return;
         }
     }
     if (Popup == null)
     {
         if (notifier is IPopupNotifier)
         {
             Popup = notifier;
             return;
         }
     }
     if (Message == null)
     {
         if (notifier is IMessageNotifier)
         {
             Message = notifier;
             return;
         }
     }
     throw new TriggerException(string.Format("could not add notifier of type {0}, either this type exists in trigger or is not supported", notifier.GetType()));
 }
示例#5
0
 public virtual void RemoveNotifier(INotifier notifier)
 {
     if (notifier is ISoundNotifier)
     {
         TriggerEntity.HasSound = false;
         Sound = null;
         return;
     }
     if (notifier is IPopupNotifier)
     {
         TriggerEntity.HasPopup = false;
         Popup = null;
         return;
     }
     throw new TriggerException("Removal of notifier failed, argument exact type: " + notifier.GetType());
 }