Beispiel #1
0
        public void Check_given_valid_cpr_with_symbols_returns_cpr_without_s(string untrimmedCPR, string trimmedCPR)
        {
            //Arrange
            var checker = new CPRParser(
                new DynamicsCPRTrimmer(),
                new DynamicsCPRValidator(new SerialNumberParser()),
                new SerialNumberParser());

            //Act
            var result = checker.Parse(untrimmedCPR);

            //Assert
            Assert.Equal(trimmedCPR, result);
        }
Beispiel #2
0
        public void Check_given_invalid_cpr_returns_null(string cpr)
        {
            //Arrange
            var checker = new CPRParser(
                new DynamicsCPRTrimmer(),
                new DynamicsCPRValidator(new SerialNumberParser()),
                new SerialNumberParser());

            //Act
            var result = checker.Parse(cpr);

            //Assert
            Assert.Null(result);
        }
Beispiel #3
0
        public void Check_given_null_returns_null()
        {
            //Arrange
            var trimmer      = new Mock <ITrimmer>();
            var validator    = new Mock <IValidator>();
            var serialParser = new Mock <ISerialNumberParser>();
            var checker      = new CPRParser(
                trimmer.Object, validator.Object, serialParser.Object);

            //Act
            var result = checker.Parse(null);

            //Assert
            Assert.Null(result);
        }
Beispiel #4
0
        public void Check_given_valid_cpr_returns_cpr()
        {
            //Arrange
            var cpr     = "2507933001";
            var checker = new CPRParser(
                new DynamicsCPRTrimmer(),
                new DynamicsCPRValidator(new SerialNumberParser()),
                new SerialNumberParser());

            //Act
            var result = checker.Parse(cpr);

            //Assert
            Assert.Equal(cpr, result);
        }
Beispiel #5
0
        public void CheckTest()
        {
            //Arrange
            var cpr     = "25079330011";
            var trimmer = new Mock <ITrimmer>();

            trimmer.Setup(t => t.Trim(It.IsAny <string>())).Returns(cpr);
            var validator = new Mock <IValidator>();

            validator.Setup(v => v.IsValid(It.IsAny <string>())).Returns(false);
            var serialParser = new Mock <ISerialNumberParser>();
            var checker      = new CPRParser(
                trimmer.Object, validator.Object, serialParser.Object);

            //Act
            var result = checker.Parse(cpr);

            //Assert
            Assert.Null(result);
        }