示例#1
0
        public void Save_valid_bird_should_invoke_repository()
        {
            var bird = new Bird("Tree sparrow");

            _validatorMock.IsValid(Arg.Any <Bird>()).Returns(true);

            _sut.Save(bird);

            _repositoryMock.Received().SaveOrUpdate(bird);
        }
示例#2
0
        public void Save(Bird bird)
        {
            if (!_validator.IsValid(bird))
            {
                throw new ArgumentException("The bird is not valid");
            }

            _repository.SaveOrUpdate(bird);
        }