예제 #1
0
        public static bool ZEqualsIPartsText(IParts ip1, IParts ip2)
        {
            int size = ip1.GetPartCount();

            object[] parts1 = ip1.GetParts();
            object[] parts2 = ip2.GetParts();
            for (int i = 0; i < size; i++)
            {
                var item1 = parts1[i];
                var item2 = parts2[i];
                if (item1 is string)
                {
                    if (!(item2 is string))
                    {
                        return(false);
                    }
                    var str1 = item2 as string;
                    var str2 = item1 as string;
                    if (str1 != str2)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
예제 #2
0
        static void NewMain(string[] args, ICalculator calculator, IParts parts, IService service, IDiscount discount)
        {
            var p = parts.GetParts(Decimal.Parse(args[0]));

            var s = service.GetService(Decimal.Parse(args[1]));

            var d = discount.GetDiscount(Decimal.Parse(args[2]));

            var total = calculator.GetTotal(p, s, d);

            Console.WriteLine("Total testy Price: $" + total);
        }
예제 #3
0
        public static bool ZEqualsIPartsParameters(IParts ip1, IParts ip2)
        {
            int size = ip1.GetPartCount();

            object[] parts1 = ip1.GetParts();
            object[] parts2 = ip2.GetParts();
            for (int i = 0; i < size; i++)
            {
                var item1 = parts1[i];
                var item2 = parts2[i];
                if (item1 is IBracket)
                {
                    if (!(item2 is IBracket))
                    {
                        return(false);
                    }
                    var b1 = item1 as IBracket;
                    var b2 = item2 as IBracket;
                    return(ZEqualsIBracket(b1, b2));
                }
            }
            return(true);
        }
예제 #4
0
 public void GetSolution()
 {
     Console.WriteLine("Factory assembler: " + _parts.GetParts());
 }