public void ProcessPayment(User user, PaymentDetails paymentDetails) { if (_userValidator.IsValid(user)) { _paymentGateway.Pay(paymentDetails); } }
/// <summary> /// Creates a User /// </summary> internal static void CreateUser() { UserDTO user = new UserDTO(); user.Name = "test"; user.Age = 15; user.Email = "test.com"; user.ValidateUser(); user.ValidateEmail(); user.SaveUser(); // Using Single Responsibility GetInstances(); userValidator.IsValid(user); emailValidator.Validate(user.Email); userCreateService.Save(user); }
public bool UserDataIsVaild(User user) { return(_validator.IsValid(user)); }