Exemplo n.º 1
0
        public void ShouldRenderTemplateCorrect()
        {
            //Arrange
            var templateBuilder  = new BotCommandsTemplateBuilder();
            var renderingService = new BotCommandsTemplateRenderingService();

            //Act
            var template = templateBuilder.GetCommandTemplate(typeof(SmallTestCommand)); //tested in ShouldGenerateDefaultCommandTemplateBasedOnModel()
            var rendered = renderingService.RenderTextTemplate(template);

            //Assert
            Assert.That(rendered, Is.EqualTo("{{prefix}}[[SmallTestCommand]] {{prefix}}[[TestNumber]] ((Number)) {{prefix}}[[TestUser]] ((UserMention))<<optional>>"));
        }
Exemplo n.º 2
0
        public void ShouldGenerateDefaultCommandTemplateBasedOnModel()
        {
            //Arrange
            var service = new BotCommandsTemplateBuilder();

            //Act
            var template = service.GetCommandTemplate(typeof(TestCommand));

            //Assert
            Assert.That(template.CommandName, Is.EqualTo("TestCommand"));
            Assert.That(template.Properties.Count(), Is.EqualTo(5));
            Assert.That(template.Properties.Count(x => x.Type == BotCommandPropertyType.Text), Is.EqualTo(1));
            Assert.That(template.Properties.Count(x => x.Type == BotCommandPropertyType.SingleWord), Is.EqualTo(2));
            Assert.That(template.Properties.Count(x => x.Type == BotCommandPropertyType.UserMention), Is.EqualTo(1));
            Assert.That(template.Properties.Count(x => x.Type == BotCommandPropertyType.Time), Is.EqualTo(0));
        }
Exemplo n.º 3
0
 public BotCommandTemplate GetCommandTemplate(Type commandType)
 {
     return(botCommandsTemplateBuilder.GetCommandTemplate(commandType));
 }