static void Main(string[] args) { var cmd = new CreateProfileCmd("Bogdan", string.Empty, "Bogdan", "*****@*****.**"); var result = CreateProfile(cmd); result.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); Console.ReadLine(); }
static void Main(string[] args) { var cmd = new CreateProfileCmd("Ion", string.Empty, "Ionescu", "*****@*****.**"); var result = CreateProfile(cmd); result.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); TestQuestion.QuestionMain(); Console.ReadLine(); }
static void Main(string[] args) { var cmd = new CreateProfileCmd("Alexandra", string.Empty, "Alexandra", "*****@*****.**"); var result = CreateProfile(cmd); result.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); Console.ReadLine(); }
static void Main(string[] args) { var cmd = new CreateProfileCmd("Cristina", string.Empty, "Cristina", "*****@*****.**"); var result = CreateProfile(cmd); result.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); Console.ReadLine(); }
static void Main(string[] args) { var cmd = new CreateProfileCmd("Ion", string.Empty, "Razvan", "*****@*****.**"); var result = CreateProfile(cmd); result.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); Console.ReadLine(); }
static void Main(string[] args) { var cmd = new CreateProfileCmd("Claudiu", string.Empty, "Avram", "*****@*****.**"); var result = CreateProfile(cmd); result.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); Console.ReadLine(); }
static void Main(string[] args) { var cmd_profile = new CreateProfileCmd("Ion", string.Empty, "Ionescu", "*****@*****.**"); var result_profile = CreateProfile(cmd_profile); var cmd_question = new CreateQuestionCmd("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++"); var result_question = CreateQuestion(cmd_question); result_profile.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); result_question.Match( ProcessQuestionCraeted, ProcessQuestionNotCreated, ProcessInvalidQuestion ); Console.ReadLine(); }
static void Main(string[] args) { var cmd = new CreateProfileCmd("Ion", string.Empty, "Ionescu", "*****@*****.**"); var cmd2 = new CreateQuestionCmd("Titlu", "Intrebare", "Java"); var result = CreateProfile(cmd); var result2 = CreateQuestion(cmd2); result.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); result2.Match(OnQuestionCreated, OnQuestionNotCreated, OnInvalidrequest); Console.ReadLine(); }
static void Main(string[] args) { var cmdProfile = new CreateProfileCmd("Ion", string.Empty, "Ionescu", "*****@*****.**"); var cmdQuestion = new CreateQuestionCmd("Ce faci?", "O simpla intrebare.", "LifeStyle"); var resultProfile = CreateProfile(cmdProfile); var resultQuestion = CreateQuestion(cmdQuestion); resultProfile.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); resultQuestion.Match( ProcessQuestionCreated, ProcessQuestionNotCreated, ProcessInvalidQuestion ); Console.ReadLine(); }
static void Main(string[] args) { //Profile var cmdProfile = new CreateProfileCmd("Ion", string.Empty, "Ionescu", "*****@*****.**"); var resultProfile = CreateProfile(cmdProfile); //Question var cmdQuestion = new CreateQuestionCmd("How to convert int to string in C#?", "I try so hard to convert int to string but i can't, the language that I use is C#.", "C#"); var resultQuestion = CreateQuestion(cmdQuestion); resultProfile.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); resultQuestion.Match( ProcessQuestionCraeted, ProcessQuestionNotCreated, ProcessInvalidQuestion ); Console.ReadLine(); }
public static ICreateProfileResult CreateProfile(CreateProfileCmd createProfileCommand) { if (string.IsNullOrWhiteSpace(createProfileCommand.EmailAddress)) { var errors = new List <string>() { "Invlaid email address" }; return(new ProfileValidationFailed(errors)); } if (new Random().Next(10) > 1) { return(new ProfileNotCreated("Email could not be verified")); } var profileId = Guid.NewGuid(); var result = new ProfileCreated(profileId, createProfileCommand.EmailAddress); return(result); }
public static ICreateProfileResult CreateProfile(CreateProfileCmd createProfileCommand) { if (string.IsNullOrWhiteSpace(createProfileCommand.EmailAddress)) { var errors = new List <string>() { "Adresa invalida" }; return(new ProfileValidationFailed(errors)); } if (new Random().Next(10) > 1) { return(new ProfileNotCreated("Email-ul nu a putut fi verificat")); } var profileId = Guid.NewGuid(); var result = new ProfileCreated(profileId, createProfileCommand.EmailAddress); //execute logic return(result); }
static void Main(string[] args) { var cmd = new CreateProfileCmd("Gabi", string.Empty, "Bildea", "*****@*****.**"); var result = CreateProfile(cmd); result.Match( ProcessProfileCreated, ProcessProfileNotCreated, ProcessInvalidProfile ); var cmd2 = new CreateQuestionCmd("Title1", "Body1", new string[] { "tag1", "tag2", "tag3" }); var result2 = CreateQuestion(cmd2); result2.Match( ProcessQuestionCreated, ProcessQuestionNotCreated, ProcessInvalidQuestion ); Console.ReadLine(); }