public void TestingEmptyPath()
        {
            List<Customer> list = null;
            var filegetter = new Mock<IRetreiveFile>();
            filegetter.Setup(x => x.GetCustomersFromJsonFile("")).Returns(list);

            var test = new GetCustomersCloseToIntercom();
            var result = test.RetrieveCustomers(filegetter.Object,"");
            Assert.AreEqual(result, null);
        }
        public void TestingSameLocationDistance()
        {
            double distance = 0.0;
            var calc = new Mock<ICalculate>();
            calc.Setup(x => x.Calculate(0.0, 0.0, 0.0, 0.0)).Returns(distance);

            var test = new GetCustomersCloseToIntercom();
            Customer c = new Customer("testCust",000,53.3381985,-6.2592576);
            List<Customer> cList = new List<Customer>{c};
            List<Customer> emptyList = new List<Customer>();
            var result = test.GetRequiredCustomers(calc.Object, cList);
            Assert.AreEqual(result, emptyList);
        }
        static void Main(string[] args)
        {
            IRetreiveFile retriver = new GetJsonText();
            ICalculate calc = new CalculateDistance();
            GetCustomersCloseToIntercom getCustomerLists = new GetCustomersCloseToIntercom();
            Console.WriteLine("Please type in your customers json file location");
            string jsonFileLocation = Console.ReadLine();

            List<Customer> customers = getCustomerLists.RetrieveCustomers(retriver,jsonFileLocation);
            List<Customer> requiredCustomers = getCustomerLists.GetRequiredCustomers(calc, customers);
            Console.WriteLine();
            Console.WriteLine("Customers within 100k from our office are listed below: ");
            foreach (Customer c in requiredCustomers)
            {
                Console.WriteLine(c.ToString());
            }
            Console.Read();
        }
Exemple #4
0
        static void Main(string[] args)
        {
            IRetreiveFile retriver = new GetJsonText();
            ICalculate    calc     = new CalculateDistance();
            GetCustomersCloseToIntercom getCustomerLists = new GetCustomersCloseToIntercom();

            Console.WriteLine("Please type in your customers json file location");
            string jsonFileLocation = Console.ReadLine();

            List <Customer> customers         = getCustomerLists.RetrieveCustomers(retriver, jsonFileLocation);
            List <Customer> requiredCustomers = getCustomerLists.GetRequiredCustomers(calc, customers);

            Console.WriteLine();
            Console.WriteLine("Customers within 100k from our office are listed below: ");
            foreach (Customer c in requiredCustomers)
            {
                Console.WriteLine(c.ToString());
            }
            Console.Read();
        }