Пример #1
0
        public void ShouldSetVersion()
        {
            var skill = new ScienceFactsSkill();

            var result = skill.FunctionHandler(basicRequest, null);

            Assert.AreEqual(result.Version, "1.0");
        }
Пример #2
0
        public void ShouldHandleUnknownIntentInScienceSkill()
        {
            var skill = new ScienceFactsSkill();

            intent.Name = "SomethingElse";

            var result = skill.FunctionHandler(basicRequest, null);
            var output = result.Response.OutputSpeech;

            Assert.AreEqual((output as PlainTextOutputSpeech).Text, "To get a science fact say: 'ask ScienceFacts for a fact'");
            Assert.AreEqual(result.Response.ShouldEndSession, true);
        }
Пример #3
0
        public void ShouldHandleStopCorrectlyInScienceSkill()
        {
            var skill = new ScienceFactsSkill();

            intent.Name = "AMAZON.StopIntent";

            var result = skill.FunctionHandler(basicRequest, null);
            var output = result.Response.OutputSpeech;

            Assert.AreEqual((output as PlainTextOutputSpeech).Text, "Bye!");
            Assert.AreEqual(result.Response.ShouldEndSession, true);
        }
Пример #4
0
        public void ShouldGiveRandomScienceFact()
        {
            var skill = new ScienceFactsSkill();

            intent.Name = "GiveScienceFact";

            var result = skill.FunctionHandler(basicRequest, null);
            var output = result.Response.OutputSpeech;

            CollectionAssert.Contains(Facts.GetFacts(), (output as PlainTextOutputSpeech).Text);
            Assert.AreEqual(result.Response.ShouldEndSession, true);
        }
Пример #5
0
        public void ShouldHandleSessionEnded()
        {
            var skill = new ScienceFactsSkill();

            var request      = new SkillRequest();
            var sessionEnded = new SessionEndedRequest();

            request.Request = sessionEnded;


            var result = skill.FunctionHandler(request, null);
            var output = result.Response.OutputSpeech;

            Assert.AreEqual(result.Response.ShouldEndSession, true);
        }