public void Not_StringPropertyTest()
        {
            //Arrange
            Expression <Func <AdvancedSearchFilter, bool> >
                   expression = x => x.Site != "google.com";
            string expected   = "NOT(+site:google.com+)";

            IAdvancedSearchFormatter searchFormatter = new DefaultSearchFormatter();

            //Act
            string actual = searchFormatter.Format(expression);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void AndAlsoTest()
        {
            //Arrange
            Expression <Func <AdvancedSearchFilter, bool> >
                   expression = x => x.IsNsfw && x.Site == "google.com";
            string expected   = "(+nsfw:1+AND+site:google.com+)";

            IAdvancedSearchFormatter searchFormatter = new DefaultSearchFormatter();

            //Act
            string actual = searchFormatter.Format(expression);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void NOT_BoolPropertyTest()
        {
            //Arrange
            Expression <Func <AdvancedSearchFilter, bool> >
                   expression = x => !x.IsNsfw;
            string expected   = "NOT(+nsfw:1+)";

            IAdvancedSearchFormatter searchFormatter = new DefaultSearchFormatter();

            //Act
            string actual = searchFormatter.Format(expression);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void AndNotOrElseTest()
        {
            //Arrange
            Expression <Func <AdvancedSearchFilter, bool> >
                   expression = x => (x.Title != "trump") && !(x.Author == "AutoModerator" || x.Site == "google.com");
            string expected   = "(+NOT(+title:trump+)+AND+NOT(+(+author:AutoModerator+OR+site:google.com+)+)+)";

            IAdvancedSearchFormatter searchFormatter = new DefaultSearchFormatter();

            //Act
            string actual = searchFormatter.Format(expression);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void TwoString_OrElseTest()
        {
            //Arrange
            Expression <Func <AdvancedSearchFilter, bool> >
                   expression = x => x.Author == "AutoModerator" || x.Site == "google.com";
            string expected   = "(+author:AutoModerator+OR+site:google.com+)";

            IAdvancedSearchFormatter searchFormatter = new DefaultSearchFormatter();

            //Act
            string actual = searchFormatter.Format(expression);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void StringVariablePropertyTest()
        {
            //Arrange
            string title = "meirl";
            Expression <Func <AdvancedSearchFilter, bool> >
                   expression = x => x.Title == title;
            string expected   = "title:meirl";

            IAdvancedSearchFormatter searchFormatter = new DefaultSearchFormatter();

            //Act
            string actual = searchFormatter.Format(expression);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void ClassVariablePropertyTest()
        {
            //Arrange
            Test t = new Test()
            {
                title = "meirl"
            };

            Expression <Func <AdvancedSearchFilter, bool> >
                   expression = x => x.Title == t.title || x.Title == t.Title || x.Title == t.TitleMethod();
            string expected   = "(+(+title:meirl+OR+title:meirl+)+OR+title:meirl+)";

            IAdvancedSearchFormatter searchFormatter = new DefaultSearchFormatter();

            //Act
            string actual = searchFormatter.Format(expression);

            //Assert
            Assert.AreEqual(expected, actual);
        }