示例#1
0
        static void Main(string[] args)
        {
            List <string> tags = new List <string>()
            {
                "Java",
                "Coding",
                "Version",
                "C++",
                "Typescript"
            };

            var result = UnverifiedQuestion.Create("I got a problem while using this in Java?");


            result.Match(
                Succ: question =>
            {
                EnableVoteQuestion(question);

                Console.WriteLine("This question can be voted.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Question was not posted because: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            List <string> tags = new List <string> {
                "Redux", "Typescript"
            };

            var result = UnverifiedQuestion.Create("Do we need an interface for our initialValues in Redux?", tags);

            result.Match(
                Succ: question =>
            {
                VoteQuestion(question);
                Console.WriteLine("Question can be voted!");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question. Reason:{ex.Message}");
                return(Unit.Default);
            }

                );

            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            List <string> tags = new List <string>()
            {
                "C++",
                "Java",
            };

            var result = UnverifiedQuestion.Create("Cum creez un constructor?", tags);

            result.Match(
                Succ: question =>
            {
                VoteQuestion(question);
                Console.WriteLine("Poti vota");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Intrebarea nu a fost postata. Motiv: {ex.Message}");
                return(Unit.Default);
            }
                );
            Console.ReadLine();
        }
示例#4
0
        static void Main(string[] args)
        {
            List <string> tags = new List <string> {
                "CSS3", "SCSS"
            };

            var result = UnverifiedQuestion.Create("How can we change bullet styling for an unordered list element?", tags);

            result.Match(
                Succ: question =>
            {
                VoteQuestion(question);
                Console.WriteLine("Question is valid for voting.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question.Reason:{ex.Message}");
                return(Unit.Default);
            }

                );

            Console.ReadLine();
        }
示例#5
0
        static void Main(string[] args)
        {
            List <string> tags = new List <string>()
            {
                "Java",
                "Coding",
                "Version"
            };

            var result = UnverifiedQuestion.Create("Can I do this in Java?");


            result.Match(
                Succ: question =>
            {
                EnableVoteQuestion(question);

                Console.WriteLine("Question is available for voting.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Question was not posted because: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
示例#6
0
        static void Main(string[] args)
        {
            var result = UnverifiedQuestion.Create("How to load local geojson file and display it on leaflet map in asp.net mvc?", new List <string>()
            {
                "javascript", "arrays"
            });


            result.Match(
                Succ: question =>
            {
                Console.WriteLine("Question posted, you can vote!");
                VoteQ(question);
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Sorry, the question couldn't be posted, see why: ");
                Console.WriteLine($"    -Reason: {ex.Message}");
                return(Unit.Default);
            }


                );

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            List <string> tags = new List <string> {
                "pssc", "C#"
            };

            var result = UnverifiedQuestion.Create("How do questions appear on this site?", tags);

            result.Match(
                Succ: question =>
            {
                StartQuestion(question);
                Console.WriteLine("Able to vote ");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question.Reason:{ex.Message}");
                return(Unit.Default);
            }

                );

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            List <string> tags = new List <string> {
                "React", "JavaScript"
            };

            var result = UnverifiedQuestion.Create("What are the differences between C and C++?", tags);

            result.Match(
                Succ: question =>
            {
                VoteQuestion(question);
                Console.WriteLine("Question is valid for voting.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question.Reason:{ex.Message}");
                return(Unit.Default);
            }

                );

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            List <string> tags = new List <string>()
            {
                "tag1", "tag2", "tag3"
            };
            var result = UnverifiedQuestion.Create("Question 1", tags);

            result.Match(
                Succ: question =>
            {
                EnableVoteQuestion(question);
                Console.WriteLine("Question can be voted.");
                return(Unit.Default);
            },

                Fail: ex =>
            {
                Console.WriteLine($"Question cannot be voted: {ex.Message}");
                return(Unit.Default);
            }
                );

            Console.ReadLine();
        }
示例#10
0
        static void Main(string[] args)
        {
            List <string> tags = new List <string> {
                "Python"
            };

            var result = UnverifiedQuestion.Create("What are tuples?How can you use them?", tags);

            result.Match(
                Succ: question =>
            {
                StartQuestion(question);
                Console.WriteLine("Able to vote ");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question.Reason:{ex.Message}");
                return(Unit.Default);
            }

                );

            Console.ReadLine();
        }
示例#11
0
        static void Main(string[] args)
        {
            List <string> tags = new List <string> {
                "C++", "C"
            };

            var result = UnverifiedQuestion.Create("What are the differences between C and C++?", tags);

            //>3taguri
            //List<string> tags = new List<string> { "C++", "C","Matlab","Java" };
            //>1000caractere
            // var result = UnverifiedQuestion.Create("What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++?What are the differences between C and C++??", tags);



            result.Match(
                Succ: question =>
            {
                StartQuestion(question);
                Console.WriteLine("Able to vote ");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question.Reason:{ex.Message}");
                return(Unit.Default);
            }

                );

            Console.ReadLine();
        }
示例#12
0
        static void Main(string[] args)
        {
            List <string> _taglist = new List <string> {
                "DDD", "Beginner"
            };                                                                                                                                                        //2 valid tags
            var questionResult = UnverifiedQuestion.Create("What is DDD?", "Hello, I would like to know more details about Domain Driver Design. Thanks!", _taglist); //valid question data example

            questionResult.Match(
                Succ: result =>                                                    //if question data is valid
            {
                UpdateVotesService(result);                                        //update votes service to maintain a valid number of votes per question
                Console.WriteLine("Question successfully was added to the list!"); //return an acknowledgment
                return(Unit.Default);
            },
                Fail: ex => //if question data is not valid
            {
                Console.WriteLine("Invalid question data. The inputs are: \n" + ex.Message);
                return(Unit.Default);
            }
                );
        }
        static void Main(string[] args)
        {
            var tagsResult     = "C#,Java,c".Split(",").ToList();
            var questionResult = UnverifiedQuestion.Create("Can I have blocking remote call in Flux.generate state generator", tagsResult);

            questionResult.Match(
                Succ: question =>
            {
                ReviewQuestionText(question);
                VoteQuestion(question);
                Console.WriteLine("Question is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );

            Console.ReadLine();
        }
示例#14
0
        static void Main(string[] args)
        {
            var tagsResult     = "C#, visual studio, debugging".Split(",").ToList();
            var questionResult = UnverifiedQuestion.Create("How do I remedy “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning?", tagsResult);

            questionResult.Match(
                Succ: question =>
            {
                ReviewQuestionText(question);
                VoteQuestion(question);
                Console.WriteLine("Question is valid!");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question! Reason: {ex.Message}");
                return(Unit.Default);
            }
                );

            Console.ReadLine();
        }
示例#15
0
        static void Main(string[] args)
        {
            var emailResult    = UnverifiedEmail.Create("*****@*****.**");
            var questionResult = UnverifiedQuestion.Create("Intrebarea", "java");


            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );
            emailResult.Match(
                Succ: question =>
            {
                SendResetPasswordLink(question);

                Console.WriteLine("Question is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
示例#16
0
        static void Main(string[] args)
        {
            var emailResult    = UnverifiedEmail.Create("*****@*****.**");
            var questionResult = UnverifiedQuestion.Create("How to create an array of objects in C++?", "I am trying to create an array of objects of my class in c++. When I print the objects, it skips the first element of array (a[0]). I have read many forums, but I can't find the problem. Who can see it?.", "c++");


            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );
            emailResult.Match(
                Succ: question =>
            {
                SendResetPasswordLink(question);

                Console.WriteLine("Question is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
示例#17
0
        static void Main(string[] args)
        {
            string[] tags     = { "C#" };
            var      question = UnverifiedQuestion.Create("Problem with homework ", "The type or namespace 'Result<>' could not be found", tags);

            // var textResult = UnverifiedText.Create("La crearea unei clase in C# tot apare aceeasi eroare.");

            question.Match(
                Succ: question =>
            {
                Console.WriteLine("Question is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid question. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
示例#18
0
        static void Main(string[] args)
        {
            List <string> taglist = new List <string> {
                "C#", "WFA"
            };
            var questionResult = UnverifiedQuestion.Create("How to change button size dynamically", "Hi, how can i change a button's size programatically, while the app is running, when something is pressed for example", taglist);

            questionResult.Match(
                Succ: question =>
            {
                VoteAddManager(question);

                Console.WriteLine("Question data is valid");

                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine(ex.Message);

                return(Unit.Default);
            }
                );
        }