public void RegisterNewClient_CorrectData_Success(string _email, string _firstName, string _lastName, string _password, bool _receiveNewsletterEmail, string _newsletterEmail)
        {
            DatabaseQueryProcessor.Erase();
            Shared.FillTheDatabase();

            var registerNewClient = new RegisterNewClientCommand
            {
                email     = _email,
                firstName = _firstName,
                lastName  = _lastName,
                password  = _password,
                receiveNewsletterEmail = _receiveNewsletterEmail,
                newsletterEmail        = _newsletterEmail
            };

            var handler = new RegisterNewClientCommandHandler();
            var result  = (SuccessInfoDto)handler.Handle(registerNewClient);

            var newClient = DatabaseQueryProcessor.GetClient(_email, PasswordEncryptor.encryptSha256(_password));

            DatabaseQueryProcessor.Erase();

            Assert.IsNotNull(newClient);
            Assert.IsTrue(result.isSuccess);
            Assert.AreEqual(_firstName, newClient.firstName);
            Assert.AreEqual(_lastName, newClient.lastName);
            Assert.AreEqual(_newsletterEmail, newClient.newsletterEmail);
        }
        public void RegisterNewClient_IncorrectNewsletterEmail_Exception(string _newsletterEmail)
        {
            DatabaseQueryProcessor.Erase();
            Shared.FillTheDatabase();

            var registerNewClient = new RegisterNewClientCommand
            {
                email     = "*****@*****.**",
                firstName = "Jane",
                lastName  = "Doe",
                password  = "******",
                receiveNewsletterEmail = true,
                newsletterEmail        = _newsletterEmail
            };

            var          handler = new RegisterNewClientCommandHandler();
            TestDelegate result  = () => handler.Handle(registerNewClient);

            DatabaseQueryProcessor.Erase();
            Assert.Throws <Exception>(result);
        }
        public void RegisterNewClient_ClentExists_Exception(string _email, string _firstName, string _lastName, string _password, bool _receiveNewsletterEmail, string _newsletterEmail)
        {
            DatabaseQueryProcessor.Erase();
            Shared.FillTheDatabase();

            var registerNewClient = new RegisterNewClientCommand
            {
                email     = _email,
                firstName = _firstName,
                lastName  = _lastName,
                password  = _password,
                receiveNewsletterEmail = _receiveNewsletterEmail,
                newsletterEmail        = _newsletterEmail
            };

            var          handler = new RegisterNewClientCommandHandler();
            TestDelegate result  = () => handler.Handle(registerNewClient);

            Assert.Throws <Exception>(result);
            DatabaseQueryProcessor.Erase();
        }