Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public async void EmployeeId_Create_Invalid_Reference()
        {
            Mock <ICustomerCommunicationRepository> customerCommunicationRepository = new Mock <ICustomerCommunicationRepository>();

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

            var validator = new ApiCustomerCommunicationServerRequestModelValidator(customerCommunicationRepository.Object);

            await validator.ValidateCreateAsync(new ApiCustomerCommunicationServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.EmployeeId, 1);
        }
Ejemplo n.º 3
0
        public async void CustomerId_Update_Invalid_Reference()
        {
            Mock <ICustomerCommunicationRepository> customerCommunicationRepository = new Mock <ICustomerCommunicationRepository>();

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

            var validator = new ApiCustomerCommunicationServerRequestModelValidator(customerCommunicationRepository.Object);

            await validator.ValidateUpdateAsync(default(int), new ApiCustomerCommunicationServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.CustomerId, 1);
        }