Exemple #1
0
        public void StopwatchWrap_Initialize_CreatesStopwatchInstance()
        {
            // Act
            var stopwatchWrap = new StopwatchWrap();

            // Assert
            Assert.NotNull(stopwatchWrap.StopwatchInstance);
        }
Exemple #2
0
        public void StopwatchWrap_Initialize_SetsStopwatchInstance()
        {
            // Arrange
            var stopwatch = new Stopwatch();

            // Act
            var stopwatchWrap = new StopwatchWrap(stopwatch);

            // Assert
            Assert.AreEqual(stopwatch, stopwatchWrap.StopwatchInstance);
        }
Exemple #3
0
    //		Default = 0,
    //		IgnoreCase = 1,
    //		DeclaredOnly = 2,
    //		Instance = 4,
    //		Static = 8,
    //		Public = 16,
    //		NonPublic = 32,
    //		FlattenHierarchy = 64,
    //		InvokeMethod = 256,
    //		CreateInstance = 512,
    //		GetField = 1024,
    //		SetField = 2048,
    //		GetProperty = 4096,
    //		SetProperty = 8192,
    //		PutDispProperty = 16384,
    //		PutRefDispProperty = 32768,
    //		ExactBinding = 65536,
    //		SuppressChangeType = 131072,
    //		OptionalParamBinding = 262144,
    //		IgnoreReturn = 16777216

    void Start()
    {
        StopwatchWrap stopwatchWrap = new StopwatchWrap();


        Abc a = new Abc();

        System.Type t  = System.Type.GetType("Abc");
        MethodInfo  mm = t.GetMethod("Moon");

        MethodInfo[] methodInfo = t.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
        //methodInfo[0].
        object [] aaaa = mm.GetCustomAttributes(true);

        System.Type TExposeble = System.Type.GetType("Exposeble");

        MethodInfo[] TExposebleMethodInfo = TExposeble.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
        //MethodInfo []methodInfoTExposeble = TExposeble.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);

        string valueString = "";

        int value = 0;

        for (int i = 0; i < 1000; ++i)
        {
            //valueString = Exposeble.Ex.Moon().ToString();
            if (ExposebleMethod.GetString("Exposeble/get_Ex/Moon", ref valueString))
            {
                //Debug.Log("Success valueString  => " + valueString);
            }
//			if(ExposebleMethod.GetInt("Exposeble/get_Ex/Moon", ref value))
//			{
//				//Debug.Log("Success =>" + value);
//			}
//			else
//			{
//				//Debug.Log("Fail@@@");
//			}
        }


        this.gameObject.AddComponent <TestCoponent>();
        stopwatchWrap.Start();

        TestCoponent ttt    = gameObject.GetComponent <TestCoponent>();
        double       second = stopwatchWrap.Stop();
        string       vavv   = value.ToString();

        //System.Threading.Thread.Sleep(1234);


        Debug.Log("Second => " + second.ToString());
        Debug.Log("Per Second => " + stopwatchWrap.ToStringFrame);
    }
Exemple #4
0
        public void StopwatchWrap_Stop_Start_IntegrationTest()
        {
            // Arrange
            var stopwatchWrap = new StopwatchWrap();

            // Act
            stopwatchWrap.Start();
            Thread.Sleep(1);
            stopwatchWrap.Stop();

            // Assert
            Assert.AreNotEqual(new TimeSpan(0, 0, 0), stopwatchWrap.Elapsed);
            Assert.AreNotEqual(0, stopwatchWrap.ElapsedMilliseconds);
            Assert.AreNotEqual(0, stopwatchWrap.ElapsedTicks);
            Assert.IsFalse(stopwatchWrap.IsRunning);
        }
Exemple #5
0
        public void StopwatchWrap_Properties_ReturnCorrectValues()
        {
            // Arrange
            var stopwatch     = new Stopwatch();
            var stopwatchWrap = new StopwatchWrap(stopwatch);

            // Act
            stopwatch.Start();
            stopwatch.Stop();

            // Assert
            Assert.AreEqual(stopwatch.Elapsed, stopwatchWrap.Elapsed);
            Assert.AreEqual(stopwatch.ElapsedMilliseconds, stopwatchWrap.ElapsedMilliseconds);
            Assert.AreEqual(stopwatch.ElapsedTicks, stopwatchWrap.ElapsedTicks);
            Assert.AreEqual(stopwatch.IsRunning, stopwatchWrap.IsRunning);
        }
Exemple #6
0
    //        Default = 0,
    //        IgnoreCase = 1,
    //        DeclaredOnly = 2,
    //        Instance = 4,
    //        Static = 8,
    //        Public = 16,
    //        NonPublic = 32,
    //        FlattenHierarchy = 64,
    //        InvokeMethod = 256,
    //        CreateInstance = 512,
    //        GetField = 1024,
    //        SetField = 2048,
    //        GetProperty = 4096,
    //        SetProperty = 8192,
    //        PutDispProperty = 16384,
    //        PutRefDispProperty = 32768,
    //        ExactBinding = 65536,
    //        SuppressChangeType = 131072,
    //        OptionalParamBinding = 262144,
    //        IgnoreReturn = 16777216
    void Start()
    {
        StopwatchWrap stopwatchWrap = new StopwatchWrap();

        Abc a = new Abc();
        System.Type t = System.Type.GetType("Abc");
        MethodInfo mm = t.GetMethod("Moon");
        MethodInfo[] methodInfo = t.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
        //methodInfo[0].
        object [] aaaa = mm.GetCustomAttributes(true);

        System.Type TExposeble = System.Type.GetType("Exposeble");

        MethodInfo[] TExposebleMethodInfo = TExposeble.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
        //MethodInfo []methodInfoTExposeble = TExposeble.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);

        string valueString = "";

        int value = 0;

        for(int i = 0; i < 1000; ++i)
        {
            //valueString = Exposeble.Ex.Moon().ToString();
            if(ExposebleMethod.GetString("Exposeble/get_Ex/Moon", ref valueString))
            {
                //Debug.Log("Success valueString  => " + valueString);
            }
        //			if(ExposebleMethod.GetInt("Exposeble/get_Ex/Moon", ref value))
        //			{
        //				//Debug.Log("Success =>" + value);
        //			}
        //			else
        //			{
        //				//Debug.Log("Fail@@@");
        //			}
        }

        this.gameObject.AddComponent<TestCoponent>();
        stopwatchWrap.Start();

        TestCoponent ttt = gameObject.GetComponent<TestCoponent>();
        double second = stopwatchWrap.Stop();
        string vavv = value.ToString();

        //System.Threading.Thread.Sleep(1234);

        Debug.Log("Second => " + second.ToString());
        Debug.Log("Per Second => " + stopwatchWrap.ToStringFrame);
    }