Exemplo n.º 1
0
        public async Task Queue()
        {
            var toBot = this.Fixture.CreateMessage();

            toBot.Text = "queue 1";

            var account     = "anaccount";
            var profile     = this.Fixture.CreateProfile();
            var teamProject = "anteamproject";

            var target = new BuildsDialog(this.Fixture.VstsService.Object, this.Fixture.VstsApplicationRegistry.Object)
            {
                Account     = account,
                Profile     = profile,
                TeamProject = teamProject
            };

            this.Fixture.VstsService
            .Setup(s => s.QueueBuildAsync(account, teamProject, 1, profile.Token))
            .ReturnsAsync(new Build {
                Id = 99
            });

            await target.QueueAsync(this.Fixture.DialogContext.Object, this.Fixture.MakeAwaitable(toBot));

            this.Fixture.VstsService.VerifyAll();
            this.Fixture.DialogContext
            .Verify(dc => dc.PostAsync(
                        It.Is <IMessageActivity>(a => a.Text.Equals("Build with id 99 is queued.", StringComparison.OrdinalIgnoreCase)),
                        CancellationToken.None));

            this.Fixture.DialogContext.Verify(c => c.Done(It.IsAny <IMessageActivity>()));
        }
Exemplo n.º 2
0
        public async Task Queue_No_Text()
        {
            var toBot = this.Fixture.CreateMessage();

            toBot.Text = null;

            var target = new BuildsDialog(this.Fixture.AuthenticationService.Object, this.Fixture.VstsService.Object);
            await target.QueueAsync(this.Fixture.DialogContext.Object, this.Fixture.MakeAwaitable(toBot));

            this.Fixture.DialogContext.Verify(c => c.Fail(It.IsAny <UnknownCommandException>()));
        }