示例#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);
 }