예제 #1
0
        public static ServiceLocatorManagerLogArgs Resetting(ServiceLocatorManager serviceLocatorManager)
        {
            var args = new ServiceLocatorManagerLogArgs();

            args.ServiceLocatorManager = serviceLocatorManager;
            args.LogType = ServiceManagerLogType.Resetting;
            return(args);
        }
예제 #2
0
        public static ServiceLocatorManagerLogArgs Missing(ServiceLocatorManager serviceLocatorManager, Type type)
        {
            var args = new ServiceLocatorManagerLogArgs();

            args.ServiceLocatorManager = serviceLocatorManager;
            args.LogType = ServiceManagerLogType.Missing;
            args.Type    = type;
            return(args);
        }
예제 #3
0
        public virtual void OnMissing(ServiceLocatorManagerLogArgs args)
        {
            Assert.AreEqual(args.LogType, ServiceManagerLogType.Missing);
            Assert.IsNotNull(args.Type);
            Assert.IsNull(args.RegisteredInstance);

            string logMsg = string.Concat("ServiceLocator - ", "Cant find Service of type: ", args.Type.Name);

            Debug.LogError(logMsg);
        }
예제 #4
0
        public static ServiceLocatorManagerLogArgs Registered(ServiceLocatorManager serviceLocatorManager, Type type, object instance)
        {
            var args = new ServiceLocatorManagerLogArgs();

            args.ServiceLocatorManager = serviceLocatorManager;
            args.LogType            = ServiceManagerLogType.Registered;
            args.Type               = type;
            args.RegisteredInstance = instance;
            return(args);
        }
예제 #5
0
        public void Log(ServiceLocatorManagerLogArgs args)
        {
            switch (args.LogType)
            {
            case ServiceManagerLogType.Registered:
                OnRegistered(args);
                break;

            case ServiceManagerLogType.Missing:
                OnMissing(args);
                break;

            case ServiceManagerLogType.Resetting:
                OnReset(args);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #6
0
 public virtual void OnReset(ServiceLocatorManagerLogArgs args)
 {
     Assert.AreEqual(args.LogType, ServiceManagerLogType.Resetting);
     Assert.IsNull(args.Type);
     Assert.IsNull(args.RegisteredInstance);
 }
예제 #7
0
 public virtual void OnRegistered(ServiceLocatorManagerLogArgs args)
 {
     Assert.AreEqual(args.LogType, ServiceManagerLogType.Registered);
     Assert.IsNotNull(args.Type);
 }