Exemple #1
0
        public void CommandExecuteCanHandleException()
        {
            //Arrange
            var internalClient = A.Fake<ICommandServiceClient>();
            A.CallTo(() => internalClient.Execute(A<AddCustomer>.Ignored)).Throws
            (
                new Exception("Exception Message")
            );

            var client = new myCustomers.QuartetClientFactory.QuartetCommandServiceWrapper(internalClient);

            var command = new AddCustomer();

            //Act
            client.Execute(command);
        }
Exemple #2
0
        public void CommandExecuteCanHandleFaultExceptionEmptyValidationMessage()
        {
            //Arrange
            var internalClient = A.Fake<ICommandServiceClient>();
            A.CallTo(() => internalClient.Execute(A<AddCustomer>.Ignored)).Throws
            (
                new FaultException<ValidationResult>(new ValidationResult { Errors = { } }, "Empty ValidationResult fault exception message")
            );

            var client = new myCustomers.QuartetClientFactory.QuartetCommandServiceWrapper(internalClient);

            var command = new AddCustomer();

            //Act
            client.Execute(command);
        }
Exemple #3
0
        public void CommandExecuteCanHandleFaultExceptionOneValidationMessage()
        {
            //Arrange
            var internalClient = A.Fake<ICommandServiceClient>();
            A.CallTo(() => internalClient.Execute(A<AddCustomer>.Ignored)).Throws
            (
                new FaultException<ValidationResult>(new ValidationResult { Errors = new string[] { "AddCustomer Failed validation due to reasons specified right here" } }, "One ValidationResult fault exception message")
            );

            var client = new myCustomers.QuartetClientFactory.QuartetCommandServiceWrapper(internalClient);

            var command = new AddCustomer();

            //Act
            client.Execute(command);
        }