Ejemplo n.º 1
0
 public NavigatorV2(
     MethodRunner runner,
     Do <Presenter> startPresenter)
     : base(runner, startPresenter)
 {
     this.locker = new object();
 }
Ejemplo n.º 2
0
 public LoggingTimer(
     Do <LoggingTimer, LogEditor> log,
     MethodRunner runner)
 {
     this.log    = log;
     this.runner = runner;
 }
Ejemplo n.º 3
0
 protected ThreadSafeNavigator(
     MethodRunner runner,
     Do <Presenter> startPresenter,
     object locker)
     : base(runner, startPresenter, locker)
 {
 }
Ejemplo n.º 4
0
 protected NavigatorV2(
     MethodRunner runner,
     object locker)
     : base(runner)
 {
     this.locker = locker;
 }
Ejemplo n.º 5
0
 protected ThreadSafeNavigator(
     MethodRunner runner,
     Do <Presenter> startPresenter,
     ICollection <Presenter> presenters)
     : base(runner, startPresenter, presenters)
 {
 }
Ejemplo n.º 6
0
 public MethodInjector(
     MethodRunner runner)
 {
     this.runner  = runner;
     this.methods = new List <Tuple <object, Type, string, string> >(
         0x10000);
 }
        public void RunEntryMethod_ThrowsExceptionIfEntryClassDoesNotHaveEntryMethod()
        {
            // Arrange
            string testEntryClassName  = "testEntryClassName";
            string testAssemblyName    = "testAssemblyName";
            string testEntryMethodName = "testEntryMethodName";

            Mock <ILoggingService <MethodRunner> > mockRunnerLS = _mockRepository.Create <ILoggingService <MethodRunner> >();

            mockRunnerLS.Setup(p => p.IsEnabled(LogLevel.Debug)).Returns(false);

            Mock <Type>     mockType         = _mockRepository.Create <Type>();
            AssemblyName    stubAssemblyName = new AssemblyName(testAssemblyName);
            Mock <Assembly> mockAssembly     = _mockRepository.Create <Assembly>();

            mockAssembly.Setup(a => a.GetType(testEntryClassName)).Returns(mockType.Object);
            mockAssembly.Setup(a => a.GetName()).Returns(stubAssemblyName);

            Mock <ITypeService> mockTypeService = _mockRepository.Create <ITypeService>();

            mockTypeService.
            Setup(t => t.GetMethod(mockType.Object, testEntryMethodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)).
            Returns((MethodInfo)null);

            MethodRunner runner = CreateLoader(mockRunnerLS.Object, typeService: mockTypeService.Object);

            // Act and Assert
            Exception result = Assert.Throws <Exception>(() => runner.Run(mockAssembly.Object, testEntryClassName, testEntryMethodName, null));

            Assert.Equal(string.Format(Strings.Exception_ClassDoesNotHaveEntryMethod, testEntryClassName, testAssemblyName, testEntryMethodName), result.Message);
        }
Ejemplo n.º 8
0
 protected NavigatorV2(
     MethodRunner runner,
     Do <Presenter> startPresenter,
     object locker)
     : base(runner, startPresenter)
 {
     this.locker = locker;
 }
Ejemplo n.º 9
0
 public LicensePresenter(
     LicenseUi ui,
     MethodRunner runner)
     : base(ui)
 {
     this.ui     = ui;
     this.runner = runner;
 }
Ejemplo n.º 10
0
 protected NavigatorV2(
     MethodRunner runner,
     Do <Presenter> startPresenter,
     ICollection <Presenter> presenters)
     : base(runner, startPresenter, presenters)
 {
     this.locker = new object();
 }
Ejemplo n.º 11
0
 public LogEditorPresenter(
     LogEditorUi ui,
     MethodRunner runner)
     : base(ui)
 {
     this.ui     = ui;
     this.runner = runner;
 }
Ejemplo n.º 12
0
 public LogStatisticsPresenter(
     LogStatisticsUi ui,
     MethodRunner runner)
     : base(ui)
 {
     this.ui     = ui;
     this.runner = runner;
 }
Ejemplo n.º 13
0
 public MainPresenter(
     MainUi ui,
     MethodRunner runner)
     : base(ui, null)
 {
     this.ui     = ui;
     this.runner = runner;
 }
Ejemplo n.º 14
0
 protected Navigator(
     MethodRunner runner,
     Do <Presenter> startPresenter,
     ICollection <Presenter> presenters)
 {
     this.runner         = runner;
     this.startPresenter = startPresenter;
     this.presenters     = presenters;
 }
Ejemplo n.º 15
0
 public Navigator(
     MethodRunner runner,
     Do <Presenter> startPresenter)
     : this(
         runner,
         startPresenter,
         new LinkedList <Presenter>())
 {
 }
Ejemplo n.º 16
0
 public LogPresenter(
     LogUi ui,
     ShellUi shell,
     MethodRunner runner)
     : base(ui, shell)
 {
     this.ui     = ui;
     this.runner = runner;
 }
 public StatisticsPresenter(
     StatisticsUi ui,
     ShellUi shell,
     MethodRunner runner)
     : base(ui, shell)
 {
     this.ui     = ui;
     this.runner = runner;
 }
Ejemplo n.º 18
0
 public TimestampEditPresenter(
     TimestampEditUi ui,
     ShellUi shell,
     MethodRunner runner)
     : base(ui, shell)
 {
     this.ui = ui;
     this.runner = runner;
 }
Ejemplo n.º 19
0
 public HomeNavPresenter(
     HomeNavUi ui,
     ShellUi shell,
     MethodRunner runner)
     : base(ui, shell)
 {
     this.ui     = ui;
     this.runner = runner;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Reports that a timing method was found.
 /// </summary>
 /// <param name="methodRunner">The method which is being added.</param>
 public void AddTimingMethod(MethodRunner methodRunner)
 {
     if (methodRunner.TimingAttribute.Singleton)
     {
         Console.WriteLine(" Info:   Found timing: {0} [Singleton]", methodRunner.Method);
     }
     else
     {
         Console.WriteLine(" Info:   Found timing: {0}", methodRunner.Method);
     }
 }
 /// <summary>
 /// Reports that a timing method was found.
 /// </summary>
 /// <param name="methodRunner">The method which is being added.</param>
 public void AddTimingMethod(MethodRunner methodRunner)
 {
     if (methodRunner.TimingAttribute.Singleton)
     {
         Console.WriteLine(" Info:   Found timing: {0} [Singleton]", methodRunner.Method);
     }
     else
     {
         Console.WriteLine(" Info:   Found timing: {0}", methodRunner.Method);
     }
 }
Ejemplo n.º 22
0
 public Navigator(
     MethodRunner runner)
     : this(
         runner,
         p =>
 {
     ThreadPool.QueueUserWorkItem(
         o => p?.Start());
 })
 {
 }
Ejemplo n.º 23
0
 public void RegisterMethod(string name, MethodRunner method)
 {
     if (!methods.ContainsKey(name))
     {
         methods.Add(name, method);
     }
     else
     {
         methods[name] = method;
     }
 }
Ejemplo n.º 24
0
        private Method BuildMethod(MethodConfig methodConfig)
        {
            var w = new SourceWriter();

            MethodDef def = this;

            var builder = new MethodRunner(methodConfig, w);

            builder.WriteMethod();

            return(new Method(methodConfig.Method.Name, methodConfig.MethodType, w.ToString()));
        }
Ejemplo n.º 25
0
        Task ISampleModelService.SaveItem(ISampleModel item) => MethodRunner.RunAsync(() =>
        {
            var dto = _mapper.MapFromSampleModel(item);

            if (item.IsNew)
            {
                _provider.CreateItem(dto);
            }
            else
            {
                _provider.UpdateItem(dto);
            }
        });
Ejemplo n.º 26
0
 public LoggingTimer(
     MethodRunner runner)
 {
     this.runner = runner;
     this.log    = (lt, le) =>
     {
         le?.AddEntry(
             DefaultEntryTypes.Information,
             new[]
         {
             @"Timer " + this.Name + @" elapsed.",
             @"Interval: " + lt.CurrentInterval
         });
     };
 }
Ejemplo n.º 27
0
        private void VerifyObjectMethod(string regionName, MethodType type, string expected)
        {
            var doc    = GetDocument();
            var config = GetDocumentConfig(doc);

            var methodImpl = GetObjectMethod(doc);
            var template   = GetResolvedTemplate(methodImpl, config);

            var region    = template.Regions.First(r => r.Name == regionName);
            var methodDef = region.MethodDefs.First();

            var writer = new SourceWriter();

            var builder = new MethodRunner(new MethodConfig(methodImpl, methodDef, type, config), writer);

            builder.WriteMethod();

            expected = expected.TrimStart('\r', '\n');

            Assert.AreEqual(expected, writer.ToString());
        }
        public void RunEntryMethod_ThrowsExceptionIfAssemblyDoesNotHaveSpecifiedEntryClass()
        {
            // Arrange
            string testEntryClassName = "testEntryClassName";
            string testAssemblyName   = "testAssemblyName";

            Mock <ILoggingService <MethodRunner> > mockRunnerLS = _mockRepository.Create <ILoggingService <MethodRunner> >();

            mockRunnerLS.Setup(p => p.IsEnabled(LogLevel.Debug)).Returns(false);

            AssemblyName    stubAssemblyName = new AssemblyName(testAssemblyName);
            Mock <Assembly> mockAssembly     = _mockRepository.Create <Assembly>();

            mockAssembly.Setup(a => a.GetType(testEntryClassName)).Returns((Type)null);
            mockAssembly.Setup(a => a.GetName()).Returns(stubAssemblyName);

            MethodRunner runner = CreateLoader(mockRunnerLS.Object);

            // Act and Assert
            Exception result = Assert.Throws <Exception>(() => runner.Run(mockAssembly.Object, testEntryClassName, null, null));

            _mockRepository.VerifyAll();
            Assert.Equal(string.Format(Strings.Exception_AssemblyDoesNotHaveClass, testAssemblyName, testEntryClassName), result.Message);
        }
Ejemplo n.º 29
0
 public ConfigKeyTappedHandler(
     MethodRunner runner)
 {
     this.runner = runner;
 }
Ejemplo n.º 30
0
 public SetupHandler(
     MethodRunner runner)
 {
     this.runner = runner;
 }
 /// <summary>
 /// Reports that a timing method was found.
 /// </summary>
 /// <param name="methodRunner">The method which is being added.</param>
 public void AddTimingMethod(MethodRunner methodRunner)
 {
     listeners.ForEach(sl => sl.AddTimingMethod(methodRunner));
 }
Ejemplo n.º 32
0
 public NewestKeyTappedHandler(
     MethodRunner runner)
 {
     this.runner = runner;
 }