Example #1
0
        public void Should_Parse_String_To_Customer()
        {
            var input    = "Jimmy,Smith,102 Long Lane,29384857";
            var customer = _parser.Parse(input);

            customer.ShouldBeEquivalentTo(new Customer
            {
                FirstName   = "Jimmy",
                LastName    = "Smith",
                Address     = "102 Long Lane",
                PhoneNumber = "29384857"
            });
        }
Example #2
0
        public INotificationHandler Process(string value)
        {
            var recordType = value.Substring(0, 3);
            var record     = value.Remove(0, 4);

            switch (recordType)
            {
            case "001":
                return(vendorRepository.Add(vendorParser.Parse(record)));

            case "002":
                return(customerRepository.Add(customerParser.Parse(record)));

            case "003":
                return(saleRepository.Add(saleParser.Parse(record)));

            default:
                throw new ArgumentOutOfRangeException("Invalid record type!");
            }
        }