Beispiel #1
0
        public void ReturnNoTagsWhenGetAnnotationsFromOneUser()
        {
            // Arrange
            var sut = new TagProcessor();

            var listAnnotations = new List <UserAnnotations>
            {
                new UserAnnotations
                {
                    UserName = "******",
                    Tags     = new List <Tag>
                    {
                        new Tag
                        {
                            Category   = "Dogs",
                            StartIndex = 0,
                            EndIndex   = 10
                        },
                        new Tag
                        {
                            Category   = "Cats",
                            StartIndex = 22,
                            EndIndex   = 25
                        }
                    }
                }
            };

            // Act
            var tagsForExpertList = sut.DisambiguateTags(listAnnotations);

            //Assert
            Assert.Empty(tagsForExpertList);
        }
Beispiel #2
0
        public void ReturnOddTag()
        {
            // Arrange
            var sut = new TagProcessor();

            var listAnnotations = new List <UserAnnotations>
            {
                new UserAnnotations
                {
                    UserName = "******",
                    Tags     = new List <Tag>
                    {
                        new Tag
                        {
                            Category   = "Dogs",
                            StartIndex = 0,
                            EndIndex   = 10
                        },
                        new Tag
                        {
                            Category   = "Cats",
                            StartIndex = 22,
                            EndIndex   = 25
                        }
                    }
                },
                new UserAnnotations
                {
                    UserName = "******",
                    Tags     = new List <Tag>
                    {
                        new Tag
                        {
                            Category   = "Dogs",
                            StartIndex = 0,
                            EndIndex   = 10
                        },
                        new Tag
                        {
                            Category   = "Cats",
                            StartIndex = 22,
                            EndIndex   = 25
                        },
                        new Tag
                        {
                            Category   = "Food",
                            StartIndex = 45,
                            EndIndex   = 60
                        },
                    }
                }
            };

            // Act
            var tagsForExpertList = sut.DisambiguateTags(listAnnotations);

            //Assert
            Assert.Single(tagsForExpertList, x => x.Category == "Food");
        }
Beispiel #3
0
        public void ThrowExceptionWithEmptyListArgument()
        {
            // Arrange
            var sut = new TagProcessor();

            var listAnnotations = new List <UserAnnotations>();

            // Act & Assert
            Assert.Throws <ArgumentException>(() => sut.DisambiguateTags(listAnnotations));
        }
Beispiel #4
0
        public void ThrowExceptionWithNullArgument()
        {
            // Arrange
            var sut = new TagProcessor();

            List <UserAnnotations> listAnnotations = null;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => sut.DisambiguateTags(listAnnotations));
        }
Beispiel #5
0
        public void ReturnBothTagsWhenDraw()
        {
            // Arrange
            var sut = new TagProcessor();

            var listAnnotations = new List <UserAnnotations>
            {
                new UserAnnotations
                {
                    UserName = "******",
                    Tags     = new List <Tag>
                    {
                        new Tag
                        {
                            Category   = "Dogs",
                            StartIndex = 0,
                            EndIndex   = 10
                        }
                    }
                },
                new UserAnnotations
                {
                    UserName = "******",
                    Tags     = new List <Tag>
                    {
                        new Tag
                        {
                            Category   = "Dogs",
                            StartIndex = 10,
                            EndIndex   = 20
                        }
                    }
                }
            };

            // Act
            var tagsForExpertList = sut.DisambiguateTags(listAnnotations);

            //Assert
            Assert.Equal(2, tagsForExpertList.Count);
        }