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(); }
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> { "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(); }
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(); }
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(); }
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(); }
public Result <VerifiedQuestion> VerifyQuestion(UnverifiedQuestion question) { //send verification link // return(new VerifiedQuestion(question.Title)); }
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(); }
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>() { "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(); }
private static void VoteAddManager(UnverifiedQuestion questionData) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(questionData); verifiedQuestionResult.Match( verifiedQuestion => { var id = Guid.NewGuid(); IReadOnlyCollection <VoteEnum> votes = Array.Empty <VoteEnum>(); var question = new AskQuestionResult.QuestionAdded(id, questionData.Title, questionData.Text, questionData.Tags, 0, votes); question = new VoteManager().Update(question, VoteEnum.Up); question = new VoteManager().Update(question, VoteEnum.Up); question = new VoteManager().Update(question, VoteEnum.Down); Console.WriteLine(question.Votes.Count); return(Unit.Default); }, ex => { Console.WriteLine("Question data could not be verified"); return(Unit.Default); } ); }
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(); }
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(); }
private static void StartQuestion(UnverifiedQuestion question) { var verifiedQuestionResult = new VerifyQuestioService().VerifyQuestion(question); verifiedQuestionResult.Match( verifiedQuestion => { new VoteService().SendVote(verifiedQuestion); return(Unit.Default); }, ex => { Console.WriteLine("Impossible to vote"); return(Unit.Default); } ); }
private static void VoteQuestion(UnverifiedQuestion question) { var voteQuestionResult = new VerifyQuestion().Verify(question); voteQuestionResult.Match( voteQuestion => { new VerifyVote().VerifyQuestionIsPosted(voteQuestion).Wait(); return(Unit.Default); }, ex => { Console.WriteLine("You are not able to vote"); return(Unit.Default); } ); }
private static void VoteQuestion(UnverifiedQuestion question) { var voteQuestionResult = new VerifyQuestionService().VerifyQuestion(question); voteQuestionResult.Match( voteQuestion => { new VerifyVoteService().VerifyIfQuestionIsPosted(voteQuestion).Wait(); return(Unit.Default); }, ex => { Console.WriteLine("You can't vote"); return(Unit.Default); } ); }
private static void ReviewQuestionText(UnverifiedQuestion question) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(question); verifiedQuestionResult.Match( verifiedQuestion => { new ReviewQuestionService().RewriteQuestionText(verifiedQuestion).Wait(); return(Unit.Default); }, ex => { Console.WriteLine("Question could not be verified"); return(Unit.Default); } ); }
private static void VoteQuestion(UnverifiedQuestion question) { var postQuestionResult = new PostQuestionService().VerifiedQuestion(question); postQuestionResult.Match( VoteQuestion => { new VoteService().VerifyVote(VoteQuestion); return(Unit.Default); }, ex => { Console.WriteLine("You can't vote this question!"); return(Unit.Default); } ); }
private static void VoteQuestion(UnverifiedQuestion question) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(question); verifiedQuestionResult.Match( VoteQuestion => { new VoteService().Vote(VoteQuestion).Wait(); return(Unit.Default); }, ex => { Console.WriteLine("You cannot vote the question!"); return(Unit.Default); } ); }
private static void EnableVoteQuestion(UnverifiedQuestion question) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(question); verifiedQuestionResult.Match( EnableVoteQuestion => { new VerifyVotesService().Vote(EnableVoteQuestion).Wait(); return(Unit.Default); }, ex => { Console.WriteLine("This question can't be voted"); return(Unit.Default); } ); }
private static void VoteQ(UnverifiedQuestion question) { var verifRes = new PublishedQuestionSRV().PostQuestion(question); verifRes.Match( VoteQ => { new Votes().Vote(VoteQ); return(Unit.Default); }, ex => { Console.WriteLine("You can't vote this question!"); return(Unit.Default); } ); }
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#, 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(); }
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(); }
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(); }
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(); }
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(); }
private static void UpdateVotesService(UnverifiedQuestion unverifiedQuestion) { IReadOnlyCollection <VoteEnum> emptyList = Array.Empty <VoteEnum>(); var verifiedQuestionResult = new VerifyQuestionData().VerifyQuestion(unverifiedQuestion); verifiedQuestionResult.Match( verifiedQuestion => //if question is verified you can vote { var questionId = Guid.NewGuid(); //simulate an added question var questionAdded = new AskQuestionResult.QuestionAdded(questionId, verifiedQuestion.Title, verifiedQuestion.Text, verifiedQuestion.Taglist, 0, emptyList); var updatedQuestion = new UpdateVotes().Update(questionAdded, VoteEnum.Up); //simulate a vote up system by giving a vote Console.WriteLine("Current question: " + updatedQuestion.Title + "\n" + "Current vote status: " + updatedQuestion.TotalVotes.Count); //check result (number of votes) return(Unit.Default); }, ex => //if question is not verified you cannot vote { Console.WriteLine("Error to vote!"); return(Unit.Default); } ); }
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); } ); }
static void MainQuestion(string[] args) { List <string> tags = new List <string>() { "Azure", "Google Cloud Platform", "Amazon Web Services" }; var result = UnverifiedQuestion.Create_question("What's the best cloud platform for enterprise?", tags); result.Match( Succ: question => { VoteQuestion(question); Console.WriteLine("You can vote this question!"); return(Unit.Default); }, Fail: ex => { Console.WriteLine($"Question could not be posted. Reason: {ex.Message}"); return(Unit.Default); } ); Console.ReadLine(); }