static void Main(string[] args)
        {
            var myRootClass = new MyRootClass();

            myRootClass.Increment();

            Console.WriteLine(myRootClass.CountExceeded());
            Console.ReadKey();
        }
Example #2
0
        public void test_root_count_exceeded_false()
        {
            var mockChildClass = new Mock <IChildClass>();

            mockChildClass.Setup(x => x.TotalNumbers()).Returns(1);

            var myObject = new MyRootClass(mockChildClass.Object);

            myObject.Increment();
            Assert.AreEqual(false, myObject.CountExceeded());
        }
        public void test_root_count_exceeded_true()
        {
            var mockChildClass = new Mock <IChildClass>();

            mockChildClass.Setup(x => x.TotalNumbers()).Returns(12);

            IOCContainer.Instance.Clear();
            IOCContainer.Instance.AddObject("IChildClass", mockChildClass.Object);

            var myObject = new MyRootClass();

            myObject.Increment();
            Assert.AreEqual(true, myObject.CountExceeded());
        }