Ejemplo n.º 1
0
        ResultStruct determineTestVerdict(ResultStruct resultStruct)
        {
            if (resultStruct.TestVerdict == TestVerdict.Pass)
            {
                if (resultStruct.TestChecks.FindAll(x => x.TestVerdict == TestVerdict.Fail || x.TestVerdict == TestVerdict.Error).Count > 0)
                {
                    resultStruct.TestVerdict = TestVerdict.Fail;
                }
            }

            return(resultStruct);
        }
Ejemplo n.º 2
0
        public override bool Effect(TriggerEvent triggerEvent, Room room, Player player, ref object data, Player ask_who, TriggerStruct info)
        {
            if (ask_who != player)
            {
                ResultStruct result = ask_who.Result;
                result.Assist++;
                ask_who.Result = result;
            }

            room.SendCompulsoryTriggerLog(ask_who, Name);
            room.BroadcastSkillInvoke(Name, ask_who, info.SkillPosition);
            room.DoAnimate(AnimateType.S_ANIMATE_INDICATE, ask_who.Name, player.Name);
            int count = (int)data;

            count++;
            data = count;
            return(false);
        }
Ejemplo n.º 3
0
        public override void Execute()
        {
            Command = new MySqlCommand(GenerateQuery(), Connection);
            MySqlDataReader read = Command.ExecuteReader();
            Result = new ResultStruct();

            if (!read.Read())
            {
                //Incorect Login
                Result.SM_ID = -1;
            }
            else
            {
                Result.SM_ID = read.GetInt32(0);
                Result.SM_EMAIL = read.GetString(1);
                Result.SM_FIRST_NAME = read.GetString(2);
                Result.SM_LAST_NAME = read.GetString(3);
                Result.SM_STORE_ID = read.GetInt32(4);
            }
            read.Close();
        }
Ejemplo n.º 4
0
 public AbstractWriter()
 {
     Result = new ResultStruct();
 }
Ejemplo n.º 5
0
        internal ResultStruct Invoke(Dictionary <int, TestClassBase> testClassDictionary)
        {
            ResultStruct resultStruct = new ResultStruct();

            try
            {
                Assembly assembly      = TestReflection.LoadTestAssembly(TestProperties.ExpandString(TestAssembly));
                Type     testClassType = TestReflection.GetTestClass(assembly, TestClass);

                TestAssert.IsNotNull(testClassType, "The test class specified \"{0}\" cannot be located or is not a valid test class.  " +
                                     "Check the test class's TestClassAttribute has been set.", TestClass);

                Type[] types = TestParameters.GetParameterTypes();

                MethodInfo testMethod = TestReflection.GetTestMethod(testClassType, TestMethod, types);

                TestAssert.IsNotNull(testMethod, "The test method specified \"{0}\" cannot be located or it is not a valid test method.  " +
                                     "Check the test method signature is correct and the TestMethodAttribute had been set.", TestMethod);

                TestClassBase testClassInstance;
                var           virtualUser = Thread.CurrentThread.Name;
                int           hashcode    = testClassType.GetHashCode() + virtualUser.GetHashCode();

                if (testClassDictionary != null && testClassDictionary.TryGetValue(hashcode, out testClassInstance))
                {
                    testClassInstance.TestMessage = null;
                    testClassInstance.ResetTestCheckCollection();
                    testClassInstance.ResetTestWarningCollection();
                    testClassInstance.ResetTestDataCollection();
                    testClassInstance.TestVerdict = TestVerdict.Pass;
                }
                else
                {
                    testClassInstance             = Activator.CreateInstance(testClassType) as TestClassBase;
                    testClassInstance.VirtualUser = virtualUser;

                    if (testClassDictionary != null)
                    {
                        testClassDictionary.Add(hashcode, testClassInstance);
                    }
                }

                object[] values = TestParameters.GetParameterValues();

                PropertyInfo property = null;

                //TODO - this needs to be abstractedfrom TestExecutor class.
                //if (!TestExecutor.SuppressExecution)
                if (true)
                {
                    resultStruct.StartTime = DateTime.Now;

                    resultStruct.TestVerdict = (TestVerdict)testMethod.Invoke(testClassInstance, values);

                    resultStruct.EndTime = DateTime.Now;

                    property = testClassType.GetProperty("TestMessage");
                    resultStruct.TestMessage = (string)property.GetValue(testClassInstance, null);
                }
                else
                {
                    resultStruct.TestVerdict = TestVerdict.Pass;
                    resultStruct.TestMessage = "Test runtime execution has been suppressed.";
                }

                // Get properties
                property = testClassType.GetProperty("TestChecks");
                resultStruct.TestChecks = (TestCheckCollection)property.GetValue(testClassInstance, null);

                property = testClassType.GetProperty("TestWarnings");
                resultStruct.TestWarnings = (TestWarningCollection)property.GetValue(testClassInstance, null);

                property = testClassType.GetProperty("TestData");
                resultStruct.TestData = (TestDataCollection)property.GetValue(testClassInstance, null);

                resultStruct = determineTestVerdict(resultStruct);
            }
            catch (Exception e)
            {
                if (e is System.Reflection.ReflectionTypeLoadException)
                {
                    var typeLoadException = e as ReflectionTypeLoadException;
                    var loaderExceptions  = typeLoadException.LoaderExceptions;
                }

                resultStruct.TestVerdict  = TestVerdict.Error;
                resultStruct.TestMessage += e.ToString();
            }

            return(resultStruct);
        }