Exemple #1
0
        public async void CustomerId_Update_Valid_Reference()
        {
            Mock <ICustomerCommunicationRepository> customerCommunicationRepository = new Mock <ICustomerCommunicationRepository>();

            customerCommunicationRepository.Setup(x => x.CustomerByCustomerId(It.IsAny <int>())).Returns(Task.FromResult <Customer>(new Customer()));

            var validator = new ApiCustomerCommunicationServerRequestModelValidator(customerCommunicationRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiCustomerCommunicationServerRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.CustomerId, 1);
        }
Exemple #2
0
        public async void EmployeeId_Create_Valid_Reference()
        {
            Mock <ICustomerCommunicationRepository> customerCommunicationRepository = new Mock <ICustomerCommunicationRepository>();

            customerCommunicationRepository.Setup(x => x.EmployeeByEmployeeId(It.IsAny <int>())).Returns(Task.FromResult <Employee>(new Employee()));

            var validator = new ApiCustomerCommunicationServerRequestModelValidator(customerCommunicationRepository.Object);
            await validator.ValidateCreateAsync(new ApiCustomerCommunicationServerRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.EmployeeId, 1);
        }
Exemple #3
0
        public async void Notes_Update_null()
        {
            Mock <ICustomerCommunicationRepository> customerCommunicationRepository = new Mock <ICustomerCommunicationRepository>();

            customerCommunicationRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new CustomerCommunication()));

            var validator = new ApiCustomerCommunicationServerRequestModelValidator(customerCommunicationRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiCustomerCommunicationServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Notes, null as string);
        }