コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: ycherkes/MockIt
        public void Init()
        {
            class2Mock = new Mock<IClass2<List<string>>>();
            class3Mock = new Mock<IClass3<Dictionary<int, string>>>();
            factoryClassMock = new Mock<IFactoryClass>();

            class2Mock1 = new Mock<IClass2<Dictionary<int, string>>>();
            class3Mock1 = new Mock<IClass3<List<string>>>();

            factoryClassMock.Setup(x => x.GetClass2<Dictionary<int, string>>()).Returns(class2Mock1.Object);
            factoryClassMock.Setup(x => x.GetClass3<List<string>>()).Returns(class3Mock1.Object);

            _sut = new Class1<List<string>, Dictionary<int, string>>(class2Mock.Object, class3Mock.Object, factoryClassMock.Object);
        }
コード例 #2
0
ファイル: Class2.cs プロジェクト: Yuanxiangz/WorkSpace
        public void bbb()
        {
            Class1 class1 = new Class1();
            TestItem item = new TestItem() { Name = "item1", Desc = "test" };
            object obj = Utils.RunMethod(typeof(Class1), "aaa", class1, new object[] { item }, BindingFlags.NonPublic | BindingFlags.Instance);

            Console.WriteLine(obj.ToString());

            Utils.RunMethod(typeof(Class1), "ttt", class1, null, BindingFlags.NonPublic | BindingFlags.Instance);
            Console.WriteLine(class1.Pro);

            PrivateObject pobj = new PrivateObject(class1);
            TestItem item1 = new TestItem() { Name = "item2", Desc = "test" };
            object obj1 = pobj.Invoke("aaa", new object[] { item1 });
            Console.WriteLine(obj1.ToString());
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: BryantVail/9-3Linq
        static void Main(string[] args)
        {
            Class1[] PartList = new Class1[8];
               PartList[0] = new Class1("electric Sander", 7,"83", 57.95 );
               PartList[1] = new Class1("Power Saw", 18,"24", 99.99 );
               PartList[2] = new Class1("Sledge Hammer", 11,"7", 21.50 );
               PartList[3] = new Class1("Hammer", 76, "77", 11.99 );
               PartList[4] = new Class1("Lawn Mower", 3, "39",79.50 );
               PartList[5] = new Class1("Jug Saw", 21, "56", 11.00 );
               PartList[6] = new Class1("Screwdriver", 106, "68", 6.99 );

               PartList[7] = new Class1( "Wrench", 34,"3",7.50);

            List<Class1> PowerTools = new List<Class1>();

            PowerTools.Add(PartList[0]);
            PowerTools.Add(PartList[1]);
            PowerTools.Add(PartList[2]);
            PowerTools.Add(PartList[3]);
            PowerTools.Add(PartList[4]);
            PowerTools.Add(PartList[5]);
            PowerTools.Add(PartList[6]);
            PowerTools.Add(PartList[7]);

            var PriceList=
                from tool in PowerTools
                orderby tool.Price
                select PowerTools;

            var quantityCheck =
                from tool in PowerTools
                orderby tool.PartDescription
                select new {quantityCheck = QuantityResult };
            int quantitycheck = quantityCheck;
                Console.WriteLine(PriceList +":"+ quantityCheck);
            bool loop = true;
            //while(loop == true)
            Console.Read();
        }