public void UpdateContractRule()
        {
            Account        genericAccount  = _accountManager.Select(1);
            Account        specificAccount = _accountManager.Select(2);
            EventType      eventType       = _eventManager.SelectEventTypeByEventType("RGLE");
            EventAttribute eventAttribute  = _eventManager.SelectEventAttributeByCode("principal");

            ContractAccountingRule rule = new ContractAccountingRule
            {
                DebitAccount     = genericAccount,
                CreditAccount    = specificAccount,
                ProductType      = OProductTypes.Loan,
                ClientType       = OClientTypes.All,
                BookingDirection = OBookingDirections.Both,
                EventType        = eventType,
                EventAttribute   = eventAttribute
            };

            rule.Id = _accountingRuleManager.AddAccountingRule(rule);
            Assert.AreNotEqual(0, rule.Id);

            rule.DebitAccount     = _accountManager.Select(2);
            rule.CreditAccount    = _accountManager.Select(4);
            rule.ProductType      = OProductTypes.Saving;
            rule.LoanProduct      = null;
            rule.SavingProduct    = _savingProductManager.SelectSavingProduct(1);
            rule.ClientType       = OClientTypes.Person;
            rule.EconomicActivity = _economicActivityManager.SelectEconomicActivity(1);
            rule.BookingDirection = OBookingDirections.Credit;

            _accountingRuleManager.UpdateAccountingRule(rule);
            ContractAccountingRule retrievedRule = _accountingRuleManager.Select(rule.Id) as ContractAccountingRule;

            _compareRules(rule, retrievedRule);
        }
Example #2
0
    public void RegisterEvent(EventType eventType)
    {
        foreach (Type type in types[typeof(EventAttribute)])
        {
            object[] attrs = type.GetCustomAttributes(typeof(EventAttribute), false);

            foreach (object attr in attrs)
            {
                EventAttribute eventAttribute = (EventAttribute)attr;

                object obj = Activator.CreateInstance(type);

                IEvent ievent = obj as IEvent;

                if (ievent == null)
                {
                    Console.WriteLine($"{obj.GetType().Name}没有继承IEvent");
                }


                Console.WriteLine("eventId:" + eventType + ":" + ievent);
                if (!this.allEvents.ContainsKey(eventType))
                {
                    this.allEvents.Add(eventType, new List <IEvent>());
                }
                this.allEvents[eventType].Add(ievent);
            }
        }
    }
Example #3
0
        private static void ValidateEventMessage(EventAttribute eventAttribute, MethodInfo method, List <ParameterMapping> parameters)
        {
            if (eventAttribute == null)
            {
                return;
            }

            var message = eventAttribute.Message;

            if (message == null)
            {
                return;
            }

            object[] defaultValues = parameters.Select(p => GetDefaultStringFormatValue(p.TargetType)).ToArray();

            try
            {
                string.Format(CultureInfo.InvariantCulture, message, defaultValues);
            }
            catch (FormatException e)
            {
                throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Invalid string format in Log Method {0}", method.Name), e);
            }
        }
        public NodeMenuItem[] AddNodeMenuItems(NodeMachineModel model, Vector2 mousePosition, NodeMachineEditor editor)
        {
            HashSet <Type>         types     = StateNodeMenuHandler.LoadStateTypes(model);
            HashSet <NodeMenuItem> menuItems = new HashSet <NodeMenuItem>();
            int eventCount = 0;

            foreach (Type type in types)
            {
                foreach (MethodInfo method in type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    EventAttribute methodEventInfo = method.GetCustomAttribute <EventAttribute>();
                    if (methodEventInfo != null)
                    {
                        eventCount++;
                        menuItems.Add(new NodeMenuItem("Events/" + type.ToString() + "/" + method.Name, () => {
                            EventNode node = new EventNode(type, method.Name, model, mousePosition);
                            editor.AddNode(node);
                        }, false, false));
                    }
                }
            }
            if (eventCount == 0)
            {
                menuItems.Add(new NodeMenuItem("Events", null, false, true));
            }
            return(menuItems.ToArray());
        }
        protected void SaveEventAttribute(EventScheduleCommand command,
                                          EventDetail eventDetail)
        {
            EventAttribute eventAttribute       = new EventAttribute();
            var            eventTicketAttribute = _eventAttributeRepository.GetByEventDetailId(eventDetail.Id);

            if (eventTicketAttribute != null)
            {
                _eventAttributeRepository.Delete(eventTicketAttribute);
            }
            var eventAttributes = new EventAttribute
            {
                TimeZoneAbbreviation = command.EventScheduleModel.TimeZoneAbbrivation,
                EventDetailId        = eventDetail.Id,
                CreatedBy            = command.ModifiedBy,
                CreatedUtc           = DateTime.UtcNow,
                IsEnabled            = true,
                TimeZone             = command.EventScheduleModel.TimeZoneOffset,
                ModifiedBy           = command.ModifiedBy,
                UpdatedBy            = command.ModifiedBy,
                UpdatedUtc           = DateTime.UtcNow
            };

            _eventAttributeRepository.Save(eventAttributes);
        }
Example #6
0
 public EventInspector(FieldInfo field)
 {
     Field     = field;
     Attribute = field.GetCustomAttribute <EventAttribute>(true);
     Name      = string.IsNullOrEmpty(Attribute.Text) ? field.Name : Attribute.Text;
     IsFoldout = true;
 }
        protected void UpdateEventAttribute(FIL.Contracts.Commands.CreateEventV1.EventRecurranceCommand eventRecurranceCommand)
        {
            EventAttribute eventAttribute       = new EventAttribute();
            var            eventDetail          = _eventDetailRepository.GetByEventId(eventRecurranceCommand.EventId);
            var            eventTicketAttribute = _eventAttributeRepository.GetByEventDetailId(eventDetail.Id);

            if (eventTicketAttribute != null)
            {
                _eventAttributeRepository.Delete(eventTicketAttribute);
            }
            var eventAttributes = new EventAttribute
            {
                TimeZoneAbbreviation = eventRecurranceCommand.TimeZoneAbbrivation,
                EventDetailId        = eventDetail.Id,
                CreatedBy            = eventRecurranceCommand.ModifiedBy,
                CreatedUtc           = DateTime.UtcNow,
                IsEnabled            = true,
                TimeZone             = eventRecurranceCommand.TimeZoneOffSet,
                ModifiedBy           = eventRecurranceCommand.ModifiedBy,
                UpdatedBy            = eventRecurranceCommand.ModifiedBy,
                UpdatedUtc           = DateTime.UtcNow
            };

            _eventAttributeRepository.Save(eventAttributes);
        }
Example #8
0
		/// <summary>
		/// Gets the appropriate EventLevel for the call context.
		/// </summary>
		/// <param name="context">The context of the call.</param>
		/// <param name="baseAttribute">The base attribute to copy if there are no additional attributes.</param>
		/// <returns>The EventLevel for the call context.</returns>
		protected virtual EventLevel GetEventLevelForContext(InvocationContext context, EventAttribute baseAttribute)
		{
			if (context == null) throw new ArgumentNullException("context");

			// for faulted methods, allow the EventExceptionAttribute to override the event level
			if (context.ContextType == InvocationContextTypes.MethodFaulted)
			{
				var attribute = context.MethodInfo.GetCustomAttribute<EventExceptionAttribute>();
				if (attribute != null)
					return attribute.Level;

				attribute = context.MethodInfo.DeclaringType.GetCustomAttribute<EventExceptionAttribute>();
				if (attribute != null)
					return attribute.Level;

				return ExceptionEventLevel;
			}

			// check for an attribute on the type
			var implementationAttribute = context.MethodInfo.DeclaringType.GetCustomAttribute<EventSourceImplementationAttribute>();
			if (implementationAttribute != null && implementationAttribute.Level.HasValue)
				return implementationAttribute.Level.Value;

			if (baseAttribute != null)
				return baseAttribute.Level;

			return EventLevel;
		}
        public void AddContractRuleForSavingsProduct()
        {
            Account        genericAccount  = _accountManager.Select(1);
            Account        specificAccount = _accountManager.Select(2);
            ISavingProduct savingsProduct  = _savingProductManager.SelectSavingProduct(1);

            EventType      eventType      = _eventManager.SelectEventTypeByEventType("RGLE");
            EventAttribute eventAttribute = _eventManager.SelectEventAttributeByCode("principal");

            ContractAccountingRule rule = new ContractAccountingRule
            {
                DebitAccount     = genericAccount,
                CreditAccount    = specificAccount,
                ProductType      = OProductTypes.Saving,
                SavingProduct    = savingsProduct,
                ClientType       = OClientTypes.Person,
                BookingDirection = OBookingDirections.Both,
                EventAttribute   = eventAttribute,
                EventType        = eventType
            };

            rule.Id = _accountingRuleManager.AddAccountingRule(rule);
            Assert.AreNotEqual(0, rule.Id);

            ContractAccountingRule retrievedRule = _accountingRuleManager.Select(rule.Id) as ContractAccountingRule;

            _compareRules(rule, retrievedRule);
        }
        public void AddContractRuleForEconomicActivity()
        {
            Account          genericAccount  = _accountManager.Select(1);
            Account          specificAccount = _accountManager.Select(2);
            EconomicActivity economicActivty = _economicActivityManager.SelectEconomicActivity(1);

            EventType      eventType      = _eventManager.SelectEventTypeByEventType("RGLE");
            EventAttribute eventAttribute = _eventManager.SelectEventAttributeByCode("principal");

            ContractAccountingRule rule = new ContractAccountingRule
            {
                DebitAccount     = genericAccount,
                CreditAccount    = specificAccount,
                ProductType      = OProductTypes.All,
                ClientType       = OClientTypes.Village,
                EconomicActivity = economicActivty,
                BookingDirection = OBookingDirections.Credit,
                EventType        = eventType,
                EventAttribute   = eventAttribute
            };

            rule.Id = _accountingRuleManager.AddAccountingRule(rule);
            Assert.AreNotEqual(0, rule.Id);

            ContractAccountingRule retrievedRule = _accountingRuleManager.Select(rule.Id) as ContractAccountingRule;

            _compareRules(rule, retrievedRule);
        }
Example #11
0
 public Event <TEventType> GetEvent <TEventType>() where TEventType : new()
 {
     if (!EventAttribute.IsEventType(typeof(TEventType)))
     {
         return(null);
     }
     return(new Event <TEventType>(EthApiContractService.Client, ContractAddress));
 }
        public void TopicAttributeMustBeInitializeWithTopic()
        {
            string topic = "topic";

            EventAttribute attribute = new EventAttribute(topic);

            attribute.Topic.ShouldBe(topic);
        }
 public Event <TEventType> GetEvent <TEventType>(string contractAddress) where TEventType : IEventDTO, new()
 {
     if (!EventAttribute.IsEventType(typeof(TEventType)))
     {
         throw new ArgumentException("The type given is not a valid Event");
     }
     return(new Event <TEventType>(Client, contractAddress));
 }
 public Event <TEventType> GetEvent <TEventType>() where TEventType : new()
 {
     if (!EventAttribute.IsEventType(typeof(TEventType)))
     {
         throw new ArgumentException("The type given is not a valid Event");
     }
     ;
     return(new Event <TEventType>(Client));
 }
Example #15
0
        public Event GetEvent <TEventType>()
        {
            if (!EventAttribute.IsEventType(typeof(TEventType)))
            {
                return(null);
            }
            var attribute = EventAttribute.GetAttribute <TEventType>();
            var contract  = new Contract(EthApiContractService, typeof(TEventType), ContractAddress);

            return(contract.GetEvent(attribute.Name));
        }
Example #16
0
 public void Reset()
 {
     Debug.Log("Reset");
     EventName      = null;
     EventAttribute = null;
     ScriptPath     = null;
     ClassName      = null;
     MethodName     = null;
     Methods        = null;
     Scripts.Clear();
 }
Example #17
0
		/// <summary>
		/// Returns an EventAttribute for the given call context.
		/// </summary>
		/// <param name="context">The context of the call.</param>
		/// <param name="nextEventId">The next event ID to use if not specified by some other mechanism.</param>
		/// <param name="parameterMapping">The parameter mapping for the method, or null if not a method call.</param>
		/// <returns>The EventAttribute for the call context.</returns>
		public virtual EventAttribute GetEventAttribute(InvocationContext context, int nextEventId, IReadOnlyCollection<ParameterMapping> parameterMapping)
		{
			if (context == null) throw new ArgumentNullException("context");

			EventAttribute eventAttribute = context.MethodInfo.GetCustomAttribute<EventAttribute>();
			if (eventAttribute != null)
				return eventAttribute;

			return new EventAttribute(nextEventId)
			{
				Level = GetEventLevelForContext(context, null),
				Message = GetEventMessage(context, parameterMapping)
			};
		}
Example #18
0
		/// <summary>
		/// Returns an EventAttribute for the Completed or Faulted events for a call context.
		/// </summary>
		/// <param name="baseAttribute">The EventAttribute for the method call that should be copied.</param>
		/// <param name="context">The context of the call.</param>
		/// <param name="nextEventId">The next event ID to use if not specified by some other mechanism.</param>
		/// <returns>The EventAttribute for the call context.</returns>
		public virtual EventAttribute CopyEventAttribute(EventAttribute baseAttribute, InvocationContext context, int nextEventId)
		{
			if (baseAttribute == null) throw new ArgumentNullException("baseAttribute");
			if (context == null) throw new ArgumentNullException("context");

			return new EventAttribute(nextEventId)
			{
				Keywords = baseAttribute.Keywords,
				Level = GetEventLevelForContext(context, baseAttribute),
				Message = GetEventMessage(context, null),
				Opcode = baseAttribute.Opcode,
				Task = baseAttribute.Task,
				Version = baseAttribute.Version
			};
		}
Example #19
0
        private static string GenerateEventCode(EventInfo eventInfo, EventAttribute eventAttribute)
        {
            string eventField = "";

            eventField += "[Event(\"" + eventAttribute.Name + "\")]\n";
            eventField += GenerateEventValues(eventInfo);
            eventField += GenerateLocalization(eventInfo);

            string typeName;

            using (var provider = new CSharpCodeProvider())
            {
                var typeRef = new CodeTypeReference(eventInfo.EventHandlerType);
                typeName = provider.GetTypeOutput(typeRef);
            }

            eventField += "public event " + typeName + " " + eventInfo.Name + ";\n\n";

            eventField += "public void " + eventInfo.Name + "Invoke(";

            ParameterInfo[] parameters = eventInfo.EventHandlerType.GetMethod("Invoke").GetParameters().OrderBy(p => p.Position).ToArray();

            string parametersCalling = "";

            using (var provider = new CSharpCodeProvider())
            {
                for (int i = 0; i < parameters.Length; i++)
                {
                    ParameterInfo parameter = parameters[i];

                    var    typeRef       = new CodeTypeReference(parameter.ParameterType);
                    string paramTypeName = provider.GetTypeOutput(typeRef);

                    eventField        += paramTypeName + " " + parameter.Name;
                    parametersCalling += parameter.Name;

                    if (i + 1 < parameters.Length)
                    {
                        eventField        += ", ";
                        parametersCalling += ", ";
                    }
                }
            }

            eventField += ") { " + eventInfo.Name + "?.Invoke(" + parametersCalling + "); }\n\n";

            return(eventField);
        }
Example #20
0
        private static string GenerateEvents(EventInfo[] events)
        {
            string eventsCode = "";

            foreach (EventInfo eventInfo in events)
            {
                EventAttribute eventAttribute = eventInfo.GetCustomAttribute <EventAttribute>();

                if (eventAttribute != null)
                {
                    eventsCode += GenerateEventCode(eventInfo, eventAttribute);
                }
            }

            return(eventsCode);
        }
Example #21
0
        private static string GenerateEventsSubscriptions(EventInfo[] events)
        {
            string subscriptionsCode = "";

            foreach (EventInfo eventInfo in events)
            {
                EventAttribute eventAttribute = eventInfo.GetCustomAttribute <EventAttribute>();

                if (eventAttribute != null)
                {
                    subscriptionsCode += GenerateEventSubscriptionCode(eventInfo);
                }
            }

            return(subscriptionsCode);
        }
Example #22
0
        public void UniqueEventIdsAndTaskOpcodePairsPerEventSource()
        {
            foreach (var eventSource in EventSourcesToValidate)
            {
                HashSet <int> eventIds = new HashSet <int>();
                HashSet <Tuple <EventTask, EventOpcode> > taskOpCodePairs = new HashSet <Tuple <EventTask, EventOpcode> >();

                var methodTypeFlags = BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy | BindingFlags.Public;
                foreach (var eventMethod in eventSource.GetType().GetMethods(methodTypeFlags))
                {
                    const bool     followInheritanceChain = true;
                    EventAttribute eventAttribute         = (EventAttribute)eventMethod.GetCustomAttributes(typeof(EventAttribute), followInheritanceChain).SingleOrDefault();

                    if (eventAttribute == null)
                    {
                        continue;
                    }

                    if (eventIds.Contains(eventAttribute.EventId))
                    {
                        throw new Exception(string.Format("Duplicate Event Id {0} in {1}", eventAttribute.EventId, eventSource));
                    }

                    eventIds.Add(eventAttribute.EventId);

                    if (eventAttribute.Task == EventTask.None)
                    {
                        // If task is none, it is generated by eventsource and is unique.
                        continue;
                    }

                    var taskOpcodePair = new Tuple <EventTask, EventOpcode>(eventAttribute.Task, eventAttribute.Opcode);
                    if (taskOpCodePairs.Contains(taskOpcodePair))
                    {
                        throw new Exception(string.Format("Duplicate Task {0} and Opcode {1} pair in {2}", eventAttribute.Task, eventAttribute.Opcode, eventSource));
                    }

                    taskOpCodePairs.Add(taskOpcodePair);
                }

                Console.WriteLine("No of events checked : {0} in {1}", eventIds.Count(), eventSource);
                Assert.IsTrue(eventIds.Count() > 0, string.Format("No events found in {0}", eventSource));
            }
        }
Example #23
0
        /// <summary>
        /// Emits the code to determine whether logging is enabled.
        /// For NonEvents, this emits the default return value to the method, and returns false here.
        /// </summary>
        /// <param name="methodBuilder">The MethodBuilder to implement.</param>
        /// <param name="eventAttribute">The EventAttribute.</param>
        /// <returns>True if events could possibly be enabled, false if this method is a NonEvent.</returns>
        private static bool EmitIsEnabled(MethodBuilder methodBuilder, EventAttribute eventAttribute)
        {
            /*
             * This method assumes that a default return value is already on the stack
             *
             * if a nonevent:
             *
             *		return (top of stack)
             *
             * if an event:
             *
             *		if (!IsEnabled(level, keywords)
             *		{
             *			return (top of stack)
             *		}
             *		else
             *			...whatever gets emitted next
             */

            ILGenerator mIL = methodBuilder.GetILGenerator();

            // if there is no event attribute, then this is a non-event, so just return silently
            if (eventAttribute == null)
            {
                mIL.Emit(OpCodes.Ret);
                return(false);
            }

            // call IsEnabled with the given event level and keywords to check whether we should log
            // NOTE: if there are no keywords, then we test to see if ANY keyword is enabled
            mIL.Emit(OpCodes.Ldarg_0);
            mIL.Emit(OpCodes.Ldc_I4, (int)eventAttribute.Level);
            mIL.Emit(OpCodes.Ldc_I8, (eventAttribute.Keywords == EventKeywords.None) ? (long)0xffffffff : (long)eventAttribute.Keywords);
            mIL.Emit(OpCodes.Call, _isEnabled);
            Label enabledLabel = mIL.DefineLabel();

            mIL.Emit(OpCodes.Brtrue, enabledLabel);
            mIL.Emit(OpCodes.Ret);
            mIL.MarkLabel(enabledLabel);

            return(true);
        }
        /// <summary>
        /// Returns an EventAttribute for the given call context.
        /// </summary>
        /// <param name="context">The context of the call.</param>
        /// <param name="nextEventId">The next event ID to use if not specified by some other mechanism.</param>
        /// <returns>The EventAttribute for the call context.</returns>
        public virtual EventAttribute GetEventAttribute(InvocationContext context, int nextEventId)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            EventAttribute eventAttribute = context.MethodInfo.GetCustomAttribute <EventAttribute>();

            if (eventAttribute != null)
            {
                return(eventAttribute);
            }

            return(new EventAttribute(nextEventId)
            {
                Level = GetEventLevelForContext(context, null),
                Message = GetEventMessage(context)
            });
        }
Example #25
0
        public static string FormatStringToUse(EventAttribute eventAttribute, EventExtendedMetadataAttribute extended)
        {
            if (extended == null)
            {
                return(eventAttribute.Message);
            }

            var newFormat = new StringBuilder();

            foreach (var field in EventExtendedMetadataAttribute.MetadataFields)
            {
                newFormat.Append(field.FormatString);
                newFormat.Append(", ");
            }

            newFormat.Append(
                ShiftFormatArguments(
                    eventAttribute.Message,
                    (ushort)EventExtendedMetadataAttribute.MetadataFields.Count));
            return(newFormat.ToString());
        }
        public void AddFundingLineRuleForFundingLine()
        {
            Account        genericAccount  = _accountManager.Select(1);
            Account        specificAccount = _accountManager.Select(2);
            FundingLine    fundingLine     = _fundingLineManager.SelectFundingLineById(1, false);
            EventType      eventType       = _eventManager.SelectEventTypeByEventType("RGLE");
            EventAttribute eventAttribute  = _eventManager.SelectEventAttributeByCode("principal");

            FundingLineAccountingRule rule = new FundingLineAccountingRule
            {
                DebitAccount     = genericAccount,
                CreditAccount    = specificAccount,
                FundingLine      = fundingLine,
                BookingDirection = OBookingDirections.Credit,
                EventAttribute   = eventAttribute,
                EventType        = eventType
            };

            rule.Id = _accountingRuleManager.AddAccountingRule(rule);
            Assert.AreNotEqual(0, rule.Id);
        }
        private ReadOnlyDictionary <int, TraceEvent> GenerateEventDescriptors(Type eventSourceType)
        {
            var eventDescriptors = new Dictionary <int, TraceEvent>();

            MethodInfo[] methods = eventSourceType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

            foreach (var eventMethod in methods)
            {
                EventAttribute eventAttribute = (EventAttribute)eventMethod.GetCustomAttributes(typeof(EventAttribute), false).SingleOrDefault();
                if (eventAttribute == null)
                {
                    continue;
                }

                var hasId          = false;
                int typeFieldIndex = -1;
#if DotNetCoreClrLinux
                var methodParams = eventMethod.GetParameters().ToList();
                if (methodParams.Any())
                {
                    typeFieldIndex = methodParams.FindIndex(e => e.Name == "type");
                    hasId          = methodParams[0].Name == "id";
                }
#endif

                var eventId = eventAttribute.EventId;

                eventDescriptors[eventId] = new TraceEvent(
                    eventMethod.Name,
                    eventAttribute.Level,
                    eventAttribute.Keywords,
                    eventAttribute.Message,
                    this.configMgr,
                    hasId,
                    typeFieldIndex);
            }

            return(new ReadOnlyDictionary <int, TraceEvent>(eventDescriptors));
        }
Example #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="eventAttribute"></param>
        /// <param name="extended"></param>
        /// <returns></returns>
        public static ServiceFabricEventChannel ChannelToUse(EventAttribute eventAttribute, EventExtendedMetadataAttribute extended)
        {
            bool hasKeywordOperational = extended != null;

            if (hasKeywordOperational)
            {
                return(ServiceFabricEventChannel.Operational);
            }
            else
            {
                bool moreSevereThanWarningLevel = eventAttribute.Level < EventLevel.Warning;

                if (moreSevereThanWarningLevel)
                {
                    return(ServiceFabricEventChannel.Admin);
                }
                else
                {
                    return(ServiceFabricEventChannel.Debug);
                }
            }
        }
Example #29
0
        /// <summary>
        /// Converts class to Valour.Net module
        /// </summary>
        /// <param name="module">Class type to convert</param>
        public void BuildModule(Type module)
        {
            ConstructorInfo   constructor    = module.GetConstructor(Type.EmptyTypes);
            CommandModuleBase moduleInstance = (CommandModuleBase)constructor.Invoke(Array.Empty <object>());

            Module.Instance = moduleInstance;
            Module.Name     = module.Name;

            foreach (MethodInfo method in module.GetMethods().Where(m => m.GetCustomAttributes(typeof(CommandAttribute), false).Length > 0))
            {
                CommandBuilder builder = new();
                builder.BuildCommand(method, Module);
            }

            foreach (MethodInfo method in module.GetMethods().Where(m => m.GetCustomAttributes(typeof(EventAttribute), false).Length > 0))
            {
                InfoModels.EventInfo eventInfo = new();
                EventAttribute       EventAttr = (EventAttribute)method.GetCustomAttribute(typeof(EventAttribute));
                eventInfo.EventName  = EventAttr.Name;
                eventInfo.Method     = method;
                eventInfo.moduleInfo = Module;
                EventService._Events.Add(eventInfo);
            }
        }
        public void DeleteRule()
        {
            Account        genericAccount  = _accountManager.Select(1);
            Account        specificAccount = _accountManager.Select(2);
            EventType      eventType       = _eventManager.SelectEventTypeByEventType("RGLE");
            EventAttribute eventAttribute  = _eventManager.SelectEventAttributeByCode("principal");

            ContractAccountingRule rule = new ContractAccountingRule
            {
                DebitAccount     = genericAccount,
                CreditAccount    = specificAccount,
                ProductType      = OProductTypes.Loan,
                ClientType       = OClientTypes.All,
                BookingDirection = OBookingDirections.Both,
                EventAttribute   = eventAttribute,
                EventType        = eventType
            };

            rule.Id = _accountingRuleManager.AddAccountingRule(rule);
            Assert.AreNotEqual(0, rule.Id);

            _accountingRuleManager.DeleteAccountingRule(rule);
            Assert.AreEqual(null, _accountingRuleManager.Select(rule.Id));
        }