public void ValidateSedol_NullInput_ReturnsResultWithAppropriateError()
        {
            string input = null;
            ISedolValidatorResult result = sedolValidator.ValidateSedol(input);

            Assert.IsNull(result.InputString);
            Assert.IsFalse(result.IsValidSedol);
            Assert.IsFalse(result.IsUserDefined);
            Assert.AreEqual(LengthValidationErrorMessage, result.ValidationDetails);
        }
        public void ShouldReturnErrForNotSevenChar()
        {
            string input  = "12";
            var    result = sedolValidator.ValidateSedol(input);

            Assert.AreEqual(result.InputString, input);
            Assert.AreEqual(result.IsUserDefined, false);
            Assert.AreEqual(result.IsValidSedol, false);
            Assert.AreEqual(result.ValidationDetails, Constants.ErrNot7Char);

            input  = "1182397189342";
            result = sedolValidator.ValidateSedol(input);
            Assert.AreEqual(result.InputString, input);
            Assert.AreEqual(result.IsUserDefined, false);
            Assert.AreEqual(result.IsValidSedol, false);
            Assert.AreEqual(result.ValidationDetails, Constants.ErrNot7Char);
        }
예제 #3
0
        public static void TestSedolValidation(ISedolValidator sedolValidator)
        {
            var listOfTestInputs = new[]
            {
                null, "", "12", "123456789",
                "1234567",
                "0709954", "B0YBKJ7",
                "9123451", "9ABCDE8",
                "9123_51", "VA.CDE8",
                "9123458", "9ABCDE1"
            };

            foreach (var input in listOfTestInputs)
            {
                var result = sedolValidator.ValidateSedol(input);
                Console.WriteLine(string.Concat(result.InputString, " | ", result.IsValidSedol, " | ", result.IsUserDefined, " | ", result.ValidationDetails));
            }
            Console.ReadLine();
        }
예제 #4
0
        public async Task <ISedolValidationResult> Get(string input)
        {
            var response = _sedolValidator.ValidateSedol(input);

            return(await Task.FromResult(response));
        }
예제 #5
0
        public void When_Input_String_Is_Null_Or_EmptyString_Or_More_Than_7_Characters()
        {
            var result = _systemUnderTest.ValidateSedol(null);

            Assert.That(result.IsUserDefined, Is.False);
            Assert.That(result.IsValidSedol, Is.False);
            Assert.That(result.ValidationDetails == "Input string was not 7-characters long", Is.True);

            result = _systemUnderTest.ValidateSedol("");

            Assert.That(result.IsUserDefined, Is.False);
            Assert.That(result.IsValidSedol, Is.False);
            Assert.That(result.ValidationDetails == "Input string was not 7-characters long", Is.True);

            result = _systemUnderTest.ValidateSedol("12");

            Assert.That(result.IsUserDefined, Is.False);
            Assert.That(result.IsValidSedol, Is.False);
            Assert.That(result.ValidationDetails == "Input string was not 7-characters long", Is.True);

            result = _systemUnderTest.ValidateSedol("123456789");

            Assert.That(result.IsUserDefined, Is.False);
            Assert.That(result.IsValidSedol, Is.False);
            Assert.That(result.ValidationDetails == "Input string was not 7-characters long", Is.True);
        }