Esempio n. 1
0
        public void UnrecognizedNumberCreatesValidationError()
        {
            //arrange
            var emptyInput      = "photo-album 0ne";
            var systemUnderTest = new PhotoAlbumInputValidator();

            //act
            var result = systemUnderTest.ValidateInput(emptyInput);

            //assert
            Assert.AreEqual(1, result.ValidationResults.Count);
            Assert.IsTrue(result.ValidationResults.Select(r => r.ErrorMessage).Contains("Unable to get page number from command"));
        }
Esempio n. 2
0
        public void EmptyStringReturnsValidationError()
        {
            //arrange
            var emptyInput      = string.Empty;
            var systemUnderTest = new PhotoAlbumInputValidator();

            //act
            var result = systemUnderTest.ValidateInput(emptyInput);

            //assert
            Assert.AreEqual(1, result.ValidationResults.Count);
            Assert.IsTrue(result.ValidationResults.Select(r => r.ErrorMessage).Contains("Must enter valid command."));
        }
Esempio n. 3
0
        public void BadCommandReturnsValidationError()
        {
            //arrange
            var emptyInput      = "bad-command 3";
            var systemUnderTest = new PhotoAlbumInputValidator();

            //act
            var result = systemUnderTest.ValidateInput(emptyInput);

            //assert
            Assert.AreEqual(1, result.ValidationResults.Count);
            Assert.IsTrue(result.ValidationResults.Select(r => r.ErrorMessage).Contains("Unrecognized command entered"));
        }
Esempio n. 4
0
        public async Task HappyPathValidator()
        {
            //arrange
            var id              = 3;
            var goodInput       = $"photo-album {id}";
            var systemUnderTest = new PhotoAlbumInputValidator();

            //act
            var result = systemUnderTest.ValidateInput(goodInput);

            //assert
            Assert.AreEqual(id, result.Id);
            Assert.AreEqual(0, result.ValidationResults.Count);
        }