示例#1
0
        public void PerformValidation_GameItemNameWithInvalidCharacters_ThrowsValidationError()
        {
            // Arrange
            var item = new EquipmentModel
            {
                Name        = "1n val!d",
                Description = "Valid description",
            };

            var command       = new AddGameItemCommand(item);
            var fakeHandler   = new AddGameItemCommandHandler();
            var fakeValidator = FakeServices.GetFakeValidator(command);

            var handler = new ValidationCommandHandlerDecorator <AddGameItemCommand>(fakeHandler, fakeValidator, new ObjectValidator());

            // Act
            handler.Handle(command);
        }
示例#2
0
        public void PerformValidation_CreateItemWithoutCategory_ThrowsValidationError()
        {
            // Arrange
            var item = new EquipmentModel
            {
                Name        = "Valid",
                Description = "Valid description"
            };

            var command       = new AddGameItemCommand(item);
            var fakeHandler   = new AddGameItemCommandHandler();
            var fakeValidator = FakeServices.GetFakeValidator(command);

            var handler = new ValidationCommandHandlerDecorator <AddGameItemCommand>(fakeHandler, fakeValidator, new ObjectValidator());

            // Act
            handler.Handle(command);
        }