示例#1
0
 public void Create()
 {
     Dashboard.Create();
     Sequence.Create();
     Signal.Create();
     FileName       = string.Empty;
     ImportFileName = string.Empty;
 }
        public void TestUpload()
        {
            SignalSubmitter.Configure("AppName", new Uri("http://localhost:8083"));
            SignalSubmitter.UploadAllSignals();

            var signal = Signal.Create("MySignal");

            signal.Raise("Somethign is failing");
        }
        public void cant_create_a_signal_with_the_same_name()
        {
            var signalName = Guid.NewGuid().ToString();

            Signal.Create(signalName);
            Action actual = () => Signal.Create(signalName);

            actual.ShouldThrow <InvalidOperationException>();
        }
示例#4
0
        public void A_通常の送受信()
        {
            var mock = Substitute.For <IObserver <Signal> >();

            Receiver.Receive().Subscribe(mock.OnNext);

            Publisher.Publish(Signal.Create());
            Publisher.Publish(Signal.Create());

            mock.Received(2).OnNext(Arg.Any <Signal>());
        }
        public void Expire_should_reset_signal_with_the_automated_indication()
        {
            var signalName = Guid.NewGuid().ToString();
            var actual     = false;
            var sut        = Signal.Create(signalName);

            sut.Raise("mofo");
            sut.Expiration  = TimeSpan.FromMilliseconds(1);
            sut.Suppressed += (sender, args) => actual = args.Automated;

            sut.Expire();

            actual.Should().BeTrue();
        }
        public void Do_not_expire_if_not_signaled()
        {
            var signalName = Guid.NewGuid().ToString();
            var actual     = false;
            var sut        = Signal.Create(signalName);

            sut.Raise("mofo");
            sut.Reset();
            sut.Expiration  = TimeSpan.FromMilliseconds(1);
            sut.Suppressed += (sender, args) => actual = true;

            sut.Expire();

            actual.Should().BeFalse();
        }
示例#7
0
        public void B_異なるインスタンスでも通す()
        {
            var mock = Substitute.For <IObserver <Signal> >();

            var signalToPublish = Signal.Create();
            var signalToReceive = Signal.Create();

            Assert.That(ReferenceEquals(signalToPublish, signalToReceive), Is.False);

            Receiver.Receive(signalToReceive).Subscribe(mock.OnNext);

            Publisher.Publish(signalToPublish);

            mock.Received().OnNext(signalToPublish);
        }
        public void signal_created_through_the_static_Create_should_get_raised_through_global_manager()
        {
            var signaled   = false;
            var reseted    = false;
            var signalName = Guid.NewGuid().ToString();

            Signal.SignalRaised     += (sender, args) => signaled = true;
            Signal.SignalSuppressed += (sender, args) => reseted = true;

            var sut = Signal.Create(signalName);

            sut.Raise("this is the reason");
            sut.Reset();

            signaled.Should().BeTrue();
            reseted.Should().BeTrue();
        }
示例#9
0
        /// <summary>
        ///     Adds a new delayed action.
        /// </summary>
        /// <param name="item">The <see cref="DelayActionItem" /> to add.</param>
        public static void Add(DelayActionItem item)
        {
            Signal.Create(delegate(object sender, Signal.RaisedArgs args)
            {
                var delayActionItem = (DelayActionItem)args.Signal.Properties["DelayActionItem"];

                if (delayActionItem.Token.IsCancellationRequested)
                {
                    return;
                }

                delayActionItem.Function();
            }, delegate(Signal signal)
            {
                var delayActionItem = (DelayActionItem)signal.Properties["DelayActionItem"];
                return(Variables.TickCount >= delayActionItem.Time);
            }, default(DateTimeOffset), new Dictionary <string, object> {
                { "DelayActionItem", item }
            });
        }
示例#10
0
        /// <summary>
        ///     Adds a new delayed action.
        /// </summary>
        /// <param name="item">The <see cref="DelayActionItem" /> to add.</param>
        public static void Add(DelayActionItem item)
        {
            Signal.Create(
                (sender, args) =>
            {
                var delayActionItem = (DelayActionItem)args.Signal.Properties["DelayActionItem"];

                if (delayActionItem.Token.IsCancellationRequested)
                {
                    return;
                }

                delayActionItem.Function();
            },
                signal =>
            {
                var delayActionItem = (DelayActionItem)signal.Properties["DelayActionItem"];
                return(Utils.TickCount >= delayActionItem.Time);
            },
                default(DateTimeOffset),
                new Dictionary <string, object> {
                { "DelayActionItem", item }
            });
        }
示例#11
0
        /// <summary>
        ///     Called when the game updates.
        /// </summary>
        /// <param name="args">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void GameOnOnUpdate(EventArgs args)
        {
            switch (Orbwalker.ActiveMode)
            {
            case OrbwalkerMode.Orbwalk:
                this.DoCombo();
                break;

            case OrbwalkerMode.Hybrid:
                this.DoHarass();
                break;
            }

            Signal.Create(
                delegate(object sender, Signal.RaisedArgs raisedArgs)
            {
                // Get lowest target
                var target = GameObjects.AllyHeroes.OrderBy(x => x.Health).FirstOrDefault();

                if (target == null)
                {
                    return;
                }

                if (target.HealthPercent > Menu["Ult"]["RPercent"].GetValue <MenuSlider>().Value)
                {
                    return;
                }

                if (Menu["Ult"]["RSurronded"].GetValue <MenuBool>().Value &&
                    !GameObjects.EnemyHeroes.Any(
                        x => x.Distance(target) < Menu["Ult"]["REnemyRadius"].GetValue <MenuSlider>().Value))
                {
                    return;
                }

                R.Cast();
                raisedArgs.Signal.Reset();
            },
                signal =>
                Menu["Ult"]["UseR"].GetValue <MenuBool>().Value &&
                GameObjects.AllyHeroes.Any(
                    x => x.HealthPercent <= Menu["Ult"]["RPercent"].GetValue <MenuSlider>().Value));

            Signal.Create(
                delegate(object sender, Signal.RaisedArgs raisedArgs)
            {
                // Get lowest target
                var target = GameObjects.AllyHeroes.OrderBy(x => x.Health).FirstOrDefault();

                if (target == null)
                {
                    return;
                }

                if (target.HealthPercent > Menu["Heal"]["AllyHealthPercent"].GetValue <MenuSlider>().Value)
                {
                    return;
                }

                W.Cast(target);
                raisedArgs.Signal.Reset();
            },
                signal =>
                Menu["Heal"]["UseW"].GetValue <MenuBool>().Value &&
                ObjectManager.Player.HealthPercent > Menu["Heal"]["UseWHealth"].GetValue <MenuSlider>().Value &&
                GameObjects.AllyHeroes.Any(
                    x => x.HealthPercent < Menu["Heal"]["AllyHealthPercent"].GetValue <MenuSlider>().Value));
        }