/// <summary> /// /// </summary> /// <param name="label">Menu label that user will see.</param> /// <param name="eventNumber">Event to execute when menu is selected.</param> /// <param name="parametersToPass">Any additional parameters to pass to event when menu is selected.</param> /// <param name="includeDataInView">This indicates whether or not to return the data present in the view when this item is a view menu item.</param> public MenuItem(string label, EventNumber eventNumber, string parametersToPass = null, bool includeDataInView = false) { Label = label; EventNumber = eventNumber; ParametersToPass = parametersToPass; IncludeDataInView = includeDataInView; }
public void Pre_And_Post_Handlers_Work_As_Expected() { var testNumber = 600; var counter = new EventNumber(testNumber, Expected); var services = new ServiceCollection(); services .AddLogging() .AddSingleton(counter) .AddSpigot(_config) .AddKnob <SimpleHeaderValidator, SimpleClass1>() .AddBeforeSend(env => { env.GetAttributes().Add("Test", Expected); }) .Build(); var provider = services.BuildServiceProvider(); var simpleSender = provider.GetService <MessageSender <SimpleClass1> >(); simpleSender.Send(new SimpleClass1(testNumber)); simpleSender.Send(new SimpleClass1(testNumber)); Assert.Equal(2, counter.EventsReceived); }
public void Correct_number_of_iterations() { var cde = new CountdownEvent(100); var testNumber = 600; var counter = new EventNumber(testNumber, "Test"); var services = new ServiceCollection(); services .AddLogging() .AddSingleton(counter) .AddSingleton(cde) .AddSpigot(_config) .AddKnob <SignalingHandler, SimpleClass1>() .Build(); var provider = services.BuildServiceProvider(); var simpleSender = provider.GetService <MessageSender <SimpleClass1> >(); for (int i = 0; i < 100; i++) { simpleSender.Send(new SimpleClass1(testNumber)); } cde.Wait(TimeSpan.FromMilliseconds(10 * 100)); Assert.Equal(0, cde.CurrentCount); }
/// <summary> /// /// </summary> /// <param name="eventNumber"></param> /// <param name="eventDataType"></param> /// <param name="parameters"></param> /// <param name="eventData"></param> public void LogSuccess(EventNumber eventNumber, EventDataType eventDataType, List <KeyValuePair <string, string> > parameters, string eventData) { var logEvent = new LogEvent { EventTime = SetDate(), ServiceInstanceId = Common.InstanceContext.ServiceId, EventNumber = eventNumber, EventType = EventType.Successful, ExternalOrgId = Common.InstanceContext.CallerOrgId, ExternalEntityId = Common.InstanceContext.CallerServiceId, EventParameters = ConvertToString(parameters), EventDataType = eventDataType, EventData = eventData }; base.Insert(logEvent); }
public void WorksOutOfTheBox() { var testNumber = 100; var counter = new EventNumber(testNumber); var services = new ServiceCollection(); services .AddLogging() .AddSingleton(counter) .AddSpigot(_config) .AddKnob <SimpleClass1Handler, SimpleClass1>() .AddKnob <ComplexClassHandler, ComplexClass>() .Build(); var provider = services.BuildServiceProvider(); var simpleSender = provider.GetService <MessageSender <SimpleClass1> >(); var complexSender = provider.GetService <MessageSender <ComplexClass> >(); simpleSender.Send(new SimpleClass1(testNumber)); simpleSender.Send(new SimpleClass1(testNumber)); complexSender.Send(new ComplexClass(testNumber)); Assert.Equal(3, counter.EventsReceived); }
public SimpleHeaderValidator(EventNumber testnumber, Archetypical.Software.Spigot.Spigot spigot, ILogger <Knob <SimpleClass1> > logger) : base(spigot, logger) { _testnumber = testnumber; }
public ComplexClassHandler(EventNumber number, Archetypical.Software.Spigot.Spigot spigot, ILogger <Knob <ComplexClass> > logger) : base(spigot, logger) { TestNumber = number; }
public SimpleClass1Handler(EventNumber number, Archetypical.Software.Spigot.Spigot spigot, ILogger <Knob <SimpleClass1> > logger) : base(spigot, logger) { TestNumber = number; }