Exemplo n.º 1
0
        public async Task Can_Insert_Vendor()
        {
            // Arrange
            var vendorCriteria = new VendorCriteria(
                name: "Innovation",
                userName: "******",
                address: null);
            var insertVendorCommand = new InsertVendor(vendorCriteria: vendorCriteria);

            // Act
            var dispatcher = this.GetDispatcher();
            var insertVendorCommandResult = await dispatcher.Command(command : insertVendorCommand, suppressExceptions : false);

            // Assert
            Assert.True(condition: insertVendorCommandResult.Success);
            Assert.IsType <CommandResult>(@object: insertVendorCommandResult);
        }
Exemplo n.º 2
0
        public async Task Can_Invoke_Command_Validator()
        {
            // Arrange
            // Arrange
            var vendorCriteria = new VendorCriteria(
                name: "Innovation",
                userName: "******",
                address: new AddressCriteria(line1: "111 Street", code: null));
            var insertVendorCommand = new InsertVendor(vendorCriteria: vendorCriteria);

            // Act
            var dispatcher    = this.GetDispatcher();
            var commandResult = (await dispatcher.Command(command: insertVendorCommand)).As <SampleValidationResult>();

            // Assert
            Assert.False(condition: commandResult.Success);
            Assert.Equal(expected: "Street Cannot Be 111 Street", actual: commandResult.Errors[0].ErrorMessage);
        }