public SimpleCustomer(string name, DateTime?registrationDate, IYearCounter yearCounter, IShoppingCart cart) { Name = name; RegistrationDate = registrationDate; _yearCounter = yearCounter; Cart = cart; }
public ValuableCustomerParser(IYearCounter yearCounter, IShoppingCart shoppingCart) { _yearCounter = yearCounter; _shoppingCart = shoppingCart; CanParseType = (int)CustomerTypes.ValuableCustomer; }
List <ICustomerParser> GetParsers(Customer testCustomer, IShoppingCart shoppingCart, IYearCounter yearCounter) { Mock <ICustomerParser> nonRegisteredCustomerParser = new Mock <ICustomerParser>(); nonRegisteredCustomerParser.SetupGet(m => m.CanParseType).Returns(1); nonRegisteredCustomerParser.Setup(x => x.ParseCustomer(testCustomer.Name, testCustomer.RegistrationDate)).Returns(new NonRegisteredCustomer(testCustomer.Name, testCustomer.RegistrationDate, shoppingCart)); Mock <ICustomerParser> simpleCustomerParser = new Mock <ICustomerParser>(); simpleCustomerParser.SetupGet(m => m.CanParseType).Returns(2); simpleCustomerParser.Setup(x => x.ParseCustomer(testCustomer.Name, testCustomer.RegistrationDate)).Returns(new SimpleCustomer(testCustomer.Name, testCustomer.RegistrationDate, yearCounter, shoppingCart)); Mock <ICustomerParser> valuableCustomerParser = new Mock <ICustomerParser>(); valuableCustomerParser.SetupGet(m => m.CanParseType).Returns(3); valuableCustomerParser.Setup(x => x.ParseCustomer(testCustomer.Name, testCustomer.RegistrationDate)).Returns(new ValuableCustomer(testCustomer.Name, testCustomer.RegistrationDate, yearCounter, shoppingCart)); Mock <ICustomerParser> mostValuableCustomerParser = new Mock <ICustomerParser>(); mostValuableCustomerParser.SetupGet(m => m.CanParseType).Returns(4); mostValuableCustomerParser.Setup(x => x.ParseCustomer(testCustomer.Name, testCustomer.RegistrationDate)).Returns(new MostValuableCustomer(testCustomer.Name, testCustomer.RegistrationDate, yearCounter, shoppingCart)); var parsers = new List <ICustomerParser>(); parsers.Add(nonRegisteredCustomerParser.Object); parsers.Add(simpleCustomerParser.Object); parsers.Add(valuableCustomerParser.Object); parsers.Add(mostValuableCustomerParser.Object); return(parsers); }
public NonRegisteredCustomerParser(IYearCounter yearCounter, IShoppingCart shoppingCart) { _yearCounter = yearCounter; _shoppingCart = shoppingCart; CanParseType = (int)CustomerTypes.NonRegisteredCustomer; }
public SimpleCustomerParser(IYearCounter yearCounter, IShoppingCart shoppingCart) { _yearCounter = yearCounter; _shoppingCart = shoppingCart; CanParseType = (int)CustomerTypes.SimpleCostumer; }