private string GetPassword(AppArguments arguments) { var value = arguments.GetProperty("p"); if (string.IsNullOrEmpty(value)) output.WriteLine("error: no password specified"); return value; }
private string GetEmail(AppArguments arguments) { var value = arguments.GetProperty("email"); if (string.IsNullOrEmpty(value)) output.WriteLine("error: no email specified"); return value; }
private string GetLastName(AppArguments arguments) { var value = arguments.GetProperty("ln"); if (string.IsNullOrEmpty(value)) output.WriteLine("error: no last name specified"); return value; }
private string GetPassword(AppArguments arguments) { var value = arguments.GetProperty("p"); if (string.IsNullOrEmpty(value)) { output.WriteLine("error: no password specified"); } return(value); }
private string GetLastName(AppArguments arguments) { var value = arguments.GetProperty("ln"); if (string.IsNullOrEmpty(value)) { output.WriteLine("error: no last name specified"); } return(value); }
private string GetEmail(AppArguments arguments) { var value = arguments.GetProperty("email"); if (string.IsNullOrEmpty(value)) { output.WriteLine("error: no email specified"); } return(value); }
public void should_output_a_missing_first_name_error() { var properties = new Dictionary<string, string>(); properties["ln"] = "Salin"; properties["email"] = "*****@*****.**"; properties["p"] = "pass123"; var arguments = new AppArguments { Command = "add", Properties = properties }; sut.Run(arguments); ((OutputStub)output).Contains("error: no first name specified").ShouldBeTrue(); }
public void should_output_a_missing_email_error() { var properties = new Dictionary<string, string>(); properties["fn"] = "Louis"; properties["ln"] = "Salin"; properties["p"] = "pass123"; var arguments = new AppArguments { Command = "add", Properties = properties }; sut.Run(arguments); ((OutputStub)output).Contains("error: no email specified").ShouldBeTrue(); }
public void Run(AppArguments arguments) { var firstname = GetFirstName(arguments); var lastname = GetLastName(arguments); var email = GetEmail(arguments); var password = GetPassword(arguments); var user = new User {FirstName = firstname, LastName = lastname, Email = email, Password = password}; persister.Save(user); }
public void Run(AppArguments arguments) { var firstname = GetFirstName(arguments); var lastname = GetLastName(arguments); var email = GetEmail(arguments); var password = GetPassword(arguments); var user = new User { FirstName = firstname, LastName = lastname, Email = email, Password = password }; persister.Save(user); }
public AppArguments Parse(string[] args) { if (args.Length == 0 || args[0].StartsWith("-")) { output.WriteLine("error: no command specified"); return null; } var arguments = new AppArguments { Command = args[0], Properties = new Dictionary<string, string>() }; for (var i = 1; i < args.Length; i++) { if (!UpdateProperties(args[i].Substring(1), arguments.Properties)) return null; } return arguments; }
public AppArguments Parse(string[] args) { if (args.Length == 0 || args[0].StartsWith("-")) { output.WriteLine("error: no command specified"); return(null); } var arguments = new AppArguments { Command = args[0], Properties = new Dictionary <string, string>() }; for (var i = 1; i < args.Length; i++) { if (!UpdateProperties(args[i].Substring(1), arguments.Properties)) { return(null); } } return(arguments); }
public void should_save_the_user() { var properties = new Dictionary<string, string>(); properties["fn"] = "Louis"; properties["ln"] = "Salin"; properties["email"] = "*****@*****.**"; properties["p"] = "pass123"; var arguments = new AppArguments { Command = "add", Properties = properties }; sut.Run(arguments); persister.SavedUser.FirstName.ShouldEqual("Louis"); persister.SavedUser.LastName.ShouldEqual("Salin"); persister.SavedUser.Email.ShouldEqual("*****@*****.**"); persister.SavedUser.Password.ShouldEqual("pass123"); }