Example #1
0
        public void TestCameraLookupError()
        {
            var errorInfo = new CameraLookupError("Oops!");
            var builder   = new CameraInfoReplyActivityBuilder(errorInfo, cameraData.Object);
            var activity  = ActivityTestUtils.CreateActivity();
            var userData  = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Text.Should().StartWith(CameraInfoReplyActivityBuilder.NotFoundMessage);
        }
Example #2
0
        public void TestEmptyList()
        {
            var builder  = new CameraListReplyActivityBuilder(new List <string>());
            var activity = ActivityTestUtils.CreateActivity();
            var userData = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            Assert.AreEqual(CameraListReplyActivityBuilder.NoCamerasFoundMessage,
                            reply.Text);
        }
Example #3
0
        public void TestOneItem()
        {
            var builder = new CameraListReplyActivityBuilder(new List <string> {
                "Camera Name 1"
            });
            var activity = ActivityTestUtils.CreateActivity();
            var userData = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Text.Should().Be("* Camera Name 1\n");
        }
Example #4
0
        public void TestCityFoundViaAlternateName()
        {
            var builder  = new SelectCityReplyActivityBuilder(new TestCameraDataServiceManager());
            var activity = ActivityTestUtils.CreateActivity();

            activity.Text = "foo";
            var userData = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Text.Should().Contain(SelectCityReplyActivityBuilder.NowViewingMessage + "City 1");
        }
Example #5
0
        public void TestCameraImageDefault()
        {
            var imageInfo = new CameraImage("Camera Name", "http://cameraurl");
            var builder   = new CameraInfoReplyActivityBuilder(imageInfo, cameraData.Object);
            var activity  = ActivityTestUtils.CreateActivity();
            var userData  = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Text.Should().Contain("![camera](" + "http://cameraurl");
            reply.Text.Should().Contain(CameraInfoReplyActivityBuilder.ViewInBrowserPrompt);
            reply.Text.Should().Contain("Camera Name");
        }
        public void TestHelp()
        {
            var builder  = new HelpReplyActivityBuilder();
            var activity = ActivityTestUtils.CreateActivity();
            var userData = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Text.Should().Contain(HelpReplyActivityBuilder.HelpHelp);
            reply.Text.Should().Contain(HelpReplyActivityBuilder.ListHelp);
            reply.Text.Should().Contain(HelpReplyActivityBuilder.SearchHelp);
            reply.Text.Should().Contain(HelpReplyActivityBuilder.ViewHelp);
        }
Example #7
0
        public void TestIntroMessage()
        {
            var cameraDataService = new Mock <ICameraDataService>();

            cameraDataService.SetupGet(cds => cds.Name).Returns("Cleveland");

            var builder  = new ConversationUpdateReplyActivityBuilder(cameraDataService.Object);
            var activity = ActivityTestUtils.CreateActivity();
            var userData = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Text.Should().Contain(SelectCityReplyActivityBuilder.NowViewingMessage + "Cleveland");
        }
Example #8
0
        public void TestCityNotFound()
        {
            var builder  = new SelectCityReplyActivityBuilder(new TestCameraDataServiceManager());
            var activity = ActivityTestUtils.CreateActivity();

            activity.Text = "Not found city";
            var userData = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Text.Should().Contain(SelectCityReplyActivityBuilder.SupportedCitiesMessage);
            reply.Text.Should().Contain("* City 1");
            reply.Text.Should().Contain("* City 2");
        }
Example #9
0
        public void TestCameraChoiceList()
        {
            var choiceInfo = new CameraChoiceList(new List <string>
            {
                "Camera 1",
                "Camera 2"
            });
            var builder  = new CameraInfoReplyActivityBuilder(choiceInfo, cameraData.Object);
            var activity = ActivityTestUtils.CreateActivity();
            var userData = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Text.Should().Contain(CameraInfoReplyActivityBuilder.CameraChoiceListPrompt);
            reply.Text.Should().Contain("1. Camera 1");
            reply.Text.Should().Contain("2. Camera 2");
        }
Example #10
0
        public void TestCameraImageTeams()
        {
            var imageInfo = new CameraImage("Camera Name", "http://cameraurl");
            var builder   = new CameraInfoReplyActivityBuilder(imageInfo, cameraData.Object);
            var activity  = ActivityTestUtils.CreateActivity();

            activity.ChannelId = "teams";
            var userData = new Mock <IUserData>();

            var reply = builder.BuildReplyActivity(activity, userData.Object);

            reply.Type.Should().Be("message");
            reply.Attachments.Count.Should().Be(1);
            var heroCard = reply.Attachments.First().Content as HeroCard;

            heroCard.Buttons.Count.Should().Be(1);
            heroCard.Title.Should().Be("Camera Name");
            heroCard.Buttons[0].Value.Should().Be("http://cameraurl");
            heroCard.Buttons[0].Type.Should().Be("openUrl");
            heroCard.Buttons[0].Title.Should().Be(CameraInfoReplyActivityBuilder.CardViewPrompt);
        }