Ejemplo n.º 1
0
        public void Instance_Is_TagHelper()
        {
            //Arrange
            var type = typeof(TagHelper);

            //Act
            var helper = new AccommodationStarRatingTagHelper();

            //Assert
            Assert.IsInstanceOf(type, helper);
        }
Ejemplo n.º 2
0
        public async Task ProcessAsync_For_Zero_Stars()
        {
            //Arrange
            var helper = new AccommodationStarRatingTagHelper();

            var tagHelperContext = TagHelperContext();

            var tagHelperOutput = TagHelperOutput(new decimal(0).ToString());

            //Act
            await helper.ProcessAsync(tagHelperContext, tagHelperOutput);

            //Assert
            Assert.AreEqual(string.Empty, tagHelperOutput.Content.GetContent());
        }
Ejemplo n.º 3
0
        public async Task ProcessAsync_For_Three_Stars()
        {
            var helper = new AccommodationStarRatingTagHelper();

            var ul = new StringBuilder("<ul class=\"list-inline\">");

            ul.AppendLine("<li><i title=\"*\" class=\"glyphicon glyphicon-star\"></i></li>");
            ul.AppendLine("<li><i title=\"*\" class=\"glyphicon glyphicon-star\"></i></li>");
            ul.AppendLine("<li><i title=\"*\" class=\"glyphicon glyphicon-star\"></i></li>");
            ul.AppendLine("</ul>");

            var html = ul.ToString();

            var tagHelperContext = TagHelperContext();

            var tagHelperOutput = TagHelperOutput("3");

            //Act
            await helper.ProcessAsync(tagHelperContext, tagHelperOutput);

            //Assert

            Assert.AreEqual(html, tagHelperOutput.Content.GetContent());
        }