Example #1
0
        static void Main(string[] args)
        {
            string fileName = args[0];
            IStringListProvider    stringListProvider = new StringListProvider(fileName);
            IPersonParser          parser             = new PersonParser();
            IPersonProviderFactory factory            = new PersonProviderFactory(stringListProvider, parser);


            IPersonProvider personProvider = factory.Create();

            var list = personProvider.GetPeople().ToList();

            list.Sort();
            IOutputPort output = new Displayer();

            output.Send(list);

            stringListProvider = new StringListProvider("sorted-names - list.txt");
            factory            = new PersonProviderFactory(stringListProvider, parser);
            personProvider     = factory.Create();
            output             = new Saver(personProvider);
            output.Send(list);
            Console.WriteLine("End");
            Console.ReadLine();
        }
        public void Create__expect__PersonProvider()
        {
            Mock <IStringListProvider> slMock = new Mock <IStringListProvider>();
            Mock <IPersonParser>       ppMock = new Mock <IPersonParser>();

            PersonProviderFactory teste = new PersonProviderFactory(slMock.Object, ppMock.Object);
            var result = teste.Create();

            Assert.IsInstanceOfType(result, typeof(PersonProvider));
        }