Example #1
0
        public async Task BodyControlThrowOnUpgradeAfterAbort()
        {
            var bodyControl = new BodyControl(Mock.Of <IHttpBodyControlFeature>(), Mock.Of <IHttpResponseControl>());

            var(request, response, requestPipe, responsePipe) = bodyControl.Start(new MockMessageBody(upgradeable: true));
            var ex = new Exception("My error");

            bodyControl.Abort(ex);

            var upgrade = bodyControl.Upgrade();

            var writeEx = await Assert.ThrowsAsync <InvalidOperationException>(() => response.WriteAsync(new byte[1], 0, 1));

            Assert.Equal(CoreStrings.ResponseStreamWasUpgraded, writeEx.Message);

            Assert.Same(ex,
                        await Assert.ThrowsAsync <Exception>(() => request.ReadAsync(new byte[1], 0, 1)));

            Assert.Same(ex,
                        await Assert.ThrowsAsync <Exception>(() => upgrade.ReadAsync(new byte[1], 0, 1)));
            Assert.Same(ex,
                        await Assert.ThrowsAsync <Exception>(async() => await requestPipe.ReadAsync()));

            await upgrade.WriteAsync(new byte[1], 0, 1);
        }
Example #2
0
    public virtual void Awake()
    {
        jumpComponent = GetComponent <JumpComponent>();
        jumpComponent.AddEventListener(this.gameObject);

        bodyControl = GetComponent <BodyControl>();
        bodyControl.AddEventListener(this.gameObject);

        animationManager = this.transform.Find("BodyContainer/Animations").GetComponent <AnimationManager2D>();
    }
Example #3
0
    public async Task RequestPipeThrowsObjectDisposedExceptionAfterStop()
    {
        var bodyControl = new BodyControl(Mock.Of <IHttpBodyControlFeature>(), Mock.Of <IHttpResponseControl>());

        var(_, response, requestPipe, responsePipe) = bodyControl.Start(new MockMessageBody());

        await bodyControl.StopAsync();

        Assert.Throws <ObjectDisposedException>(() => requestPipe.AdvanceTo(new SequencePosition()));
        Assert.Throws <ObjectDisposedException>(() => requestPipe.AdvanceTo(new SequencePosition(), new SequencePosition()));
        Assert.Throws <ObjectDisposedException>(() => requestPipe.CancelPendingRead());
        Assert.Throws <ObjectDisposedException>(() => requestPipe.TryRead(out var res));
        Assert.Throws <ObjectDisposedException>(() => requestPipe.Complete());
        await Assert.ThrowsAsync <ObjectDisposedException>(async() => await requestPipe.ReadAsync());
    }
Example #4
0
        public async Task BodyControlThrowAfterAbort()
        {
            var bodyControl = new BodyControl(Mock.Of <IHttpBodyControlFeature>(), Mock.Of <IHttpResponseControl>());

            var(request, response, requestPipe, responsePipe) = bodyControl.Start(new MockMessageBody());

            var ex = new Exception("My error");

            bodyControl.Abort(ex);

            await response.WriteAsync(new byte[1], 0, 1);

            Assert.Same(ex,
                        await Assert.ThrowsAsync <Exception>(() => request.ReadAsync(new byte[1], 0, 1)));
            Assert.Same(ex,
                        await Assert.ThrowsAsync <Exception>(async() => await requestPipe.ReadAsync()));
        }
Example #5
0
    public async Task ResponsePipeThrowsObjectDisposedExceptionAfterStop()
    {
        var bodyControl = new BodyControl(Mock.Of <IHttpBodyControlFeature>(), Mock.Of <IHttpResponseControl>());

        var(_, response, requestPipe, responsePipe) = bodyControl.Start(new MockMessageBody());

        await bodyControl.StopAsync();

        Assert.Throws <ObjectDisposedException>(() => responsePipe.Advance(1));
        Assert.Throws <ObjectDisposedException>(() => responsePipe.CancelPendingFlush());
        Assert.Throws <ObjectDisposedException>(() => responsePipe.GetMemory());
        Assert.Throws <ObjectDisposedException>(() => responsePipe.GetSpan());
        Assert.Throws <ObjectDisposedException>(() => responsePipe.Complete());
        await Assert.ThrowsAsync <ObjectDisposedException>(async() => await responsePipe.WriteAsync(new Memory <byte>()));

        await Assert.ThrowsAsync <ObjectDisposedException>(async() => await responsePipe.FlushAsync());
    }
Example #6
0
    public async Task RequestPipeMethodsThrowAfterAbort()
    {
        var bodyControl = new BodyControl(Mock.Of <IHttpBodyControlFeature>(), Mock.Of <IHttpResponseControl>());

        var(_, response, requestPipe, responsePipe) = bodyControl.Start(new MockMessageBody(upgradeable: true));
        var ex = new Exception("My error");

        bodyControl.Abort(ex);

        await response.WriteAsync(new byte[1], 0, 1);

        Assert.Same(ex,
                    Assert.Throws <Exception>(() => requestPipe.AdvanceTo(new SequencePosition())));
        Assert.Same(ex,
                    Assert.Throws <Exception>(() => requestPipe.AdvanceTo(new SequencePosition(), new SequencePosition())));
        Assert.Same(ex,
                    Assert.Throws <Exception>(() => requestPipe.CancelPendingRead()));
        Assert.Same(ex,
                    Assert.Throws <Exception>(() => requestPipe.TryRead(out var res)));
        Assert.Same(ex,
                    Assert.Throws <Exception>(() => requestPipe.Complete()));
    }
 private void initializeUserControls()
 {
     introComponent                = new IntroControl(WM);
     raceComponent                 = new RaceControl(WM);
     alignmentComponent            = new AlignmentControl(WM);
     raceComponent.SubraceChanged += new EventHandler(raceComponent_SubraceChanged);
     ageComponent        = new AgeControl(WM);
     bodyComponent       = new BodyControl(WM);
     appearanceComponent = new AppearanceControl(WM);
     appearanceComponent.AppearanceChanged += new EventHandler(appearanceComponent_AppearanceChanged);
     classComponent = new ClassControl(WM);
     classComponent.ClassChanged       += new EventHandler(classComponent_ClassChanged);
     classComponent.ClassChoiceChanged += new EventHandler(classComponent_ClassChoiceChanged);
     backgroundComponent = new BackgroundControl(WM);
     abilityComponent    = new AbilityControl(WM);
     abilityComponent.AbilityAssigned      += new EventHandler(abilityComponent_AbilityAssigned);
     abilityComponent.AbilityBonusAssigned += new EventHandler(abilityComponent_AbilityBonusAssigned);
     languageComponent = new LanguageControl(WM);
     languageComponent.LanguageSelectionChanged += new EventHandler(languageComponent_LanguageSelectionChanged);
     skillComponent              = new SkillControl(WM);
     skillComponent.SkillChosen += new EventHandler(skillComponent_SkillChosen);
     equipmentComponent          = new EquipmentControl(WM);
     equipmentComponent.EquipmentSelectionChanged += new EventHandler(equipmentComponent_EquipmentSelectionChanged);
     spellComponent              = new SpellControl(WM);
     spellComponent.SpellChosen += new EventHandler(spellComponent_SpellChosen);
     extraRaceChoiceComponent    = new ExtraRaceChoiceControl(WM);
     extraRaceChoiceComponent.ExtraRaceChoiceChanged += new EventHandler(extraRaceChoiceComponent_ExtraRaceChoiceChanged);
     extraClassChoiceComponent = new ExtraClassChoiceControl(WM);
     extraClassChoiceComponent.SubcontrolOptionChosen += new EventHandler(extraClassChoiceComponent_SubcontrolOptionChosen);
     extraSubclassChoiceComponent = new ExtraSubclassChoiceControl(WM);
     extraSubclassChoiceComponent.SubcontrolOptionChosen += new EventHandler(extraSubclassChoiceComponent_SubcontrolOptionChosen);
     nameComponent                          = new NameControl(WM);
     nameComponent.NameChanged             += new EventHandler(nameComponent_NameChanged);
     storyComponent                         = new StoryControl(WM);
     storyComponent.SubcontrolOptionChosen += new EventHandler(storyComponent_SubcontrolOptionChosen);
     exportComponent                        = new ExportControl(WM);
 }
Example #8
0
 public void Awake()
 {
     playerControl = GetComponent <CharacterControl>();
     bodyControl   = GetComponent <BodyControl>();
     player        = GetComponent <Player>();
 }
Example #9
0
 // Use this for initialization
 void Start()
 {
     controlComponent = mainParent.GetComponent <BodyControl>();
     //gameObject.transform.parent.transform.GetComponent<InputControl>();
 }