Пример #1
0
 public GuideResponse Execute(string content)
 {
     return(new GuideResponse()
     {
         Message = DirectiveProxy <HowManyCommandDirective> .Create(content).Command.Execute()?.ToString()
     });
 }
        public void SetAliasForRomanNumber()
        {
            var romanNumber = DirectiveProxy <AliasCommandDirective> .Create("glob is I").Command.Execute() as RomanNumber;

            Assert.That(romanNumber, Is.Not.Null);
            Assert.That(romanNumber.Symbol, Is.EqualTo(SymbolEnum.I));
            Assert.That(romanNumber.Value, Is.EqualTo(1));
            Assert.That(romanNumber.Alias, Is.EqualTo("glob"));
            Assert.That(AliasCommand.GetRomanNumberByAlias("glob"), Is.Not.Null);
        }
Пример #3
0
        public void CalculateAmount()
        {
            DirectiveProxy <AliasCommandDirective> .Create("glob is I").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("prok is V").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("pish is X").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("tegj is L").Command.Execute();

            var response = DirectiveProxy <HowMuchCommandDirective> .Create("how much is pish tegj glob glob ?").Command.Execute();

            Assert.That(response?.ToString(), Is.EqualTo("pish tegj glob glob is 42"));
        }
        public void SetProductPrice()
        {
            DirectiveProxy <AliasCommandDirective> .Create("glob is I").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("prok is V").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("pish is X").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("tegj is L").Command.Execute();

            var unitPrice = DirectiveProxy <UnitPriceCommandDirective> .Create("glob glob Silver is 34 Credits").Command.Execute();

            Assert.That((decimal)unitPrice, Is.EqualTo(17));
            Assert.That(UnitPriceCommand.GetUnitPriceByProductName("Silver"), Is.EqualTo(17));
        }
        public void SetProductPrice()
        {
            DirectiveProxy <AliasCommandDirective> .Create("glob is I").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("prok is V").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("pish is X").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("tegj is L").Command.Execute();

            DirectiveProxy <UnitPriceCommandDirective> .Create("glob glob Silver is 34 Credits").Command.Execute();

            var response = DirectiveProxy <UnknownCommandDirective> .Create("how much wood could a woodchuck chuck if a woodchuck could chuck wood ?").Command.Execute();

            Assert.That(response?.ToString(), Is.EqualTo("I have no idea what you are talking about"));
        }
Пример #6
0
        public void CalculateProductAmount()
        {
            DirectiveProxy <AliasCommandDirective> .Create("glob is I").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("prok is V").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("pish is X").Command.Execute();

            DirectiveProxy <AliasCommandDirective> .Create("tegj is L").Command.Execute();

            DirectiveProxy <UnitPriceCommandDirective> .Create("glob glob Silver is 34 Credits").Command.Execute();

            var response = DirectiveProxy <HowManyCommandDirective> .Create("how many Credits is glob prok Silver ?").Command.Execute();

            Assert.That(response?.ToString(), Is.EqualTo("glob prok Silver is 68 Credits"));
        }
        public GuideResponse Execute(string content)
        {
            DirectiveProxy <UnitPriceCommandDirective> .Create(content).Command.Execute()?.ToString();

            return(GuideResponse.Empty);
        }