private bool СheckUniqEmail(AddEditClient clientFromView)
        {
            if (!String.IsNullOrEmpty(clientFromView.ClientId))
            {
                if (String.Compare(clientFromView.ClientEmail, ClientsRepository.GetClientById(SetClientData(clientFromView).DbClientId).DbClientEmail) == 0)
                {
                    return(true);
                }
            }
            if (ClientsRepository.GetClientByEmail(clientFromView.ClientEmail).DbClientEmail == null)
            {
                return(true);
            }

            return(false);
        }
Example #2
0
        public void ClientsRepository_GetClientByEmail_NonExistingEmail_ReturnsNullClient()
        {
            //Arrange
            string url = ArrangeProvider._URL_;

            var client = ArrangeProvider.GetClient(email: ArrangeProvider._EMAIL_);
            var json   = JsonConvert.SerializeObject(ArrangeProvider.GetRootClient(client), Formatting.Indented);

            var options    = ArrangeProvider.GetResourcesUrlOption(url, url);
            var httpClient = ArrangeProvider.GetMockJsonHttpClient(url, json);

            var clientsRepository = new ClientsRepository(options, httpClient);

            //Act
            var result = clientsRepository.GetClientByEmail(ArrangeProvider._EMAIL2_);

            //Assert
            Assert.IsNull(result);
        }