コード例 #1
0
    public void SkillSelected(int index)
    {
        TestStat        improve = TestStat.None;
        List <TestStat> stats   = improvingInvestigator.ImprovableSkills();

        for (int i = 0; i < stats.Count; i++)
        {
            if (i == index)
            {
                improve = stats[i];
            }
        }
        if (improve == TestStat.None)
        {
            Debug.LogError("Error selecting stat");
        }
        else
        {
            improvingInvestigator.ImproveStat(improve);

            GameManager.SingleInstance.App.Controller.queueController.CreateCallBackQueue(StatImproved);       // Create Queue
            GameManager.SingleInstance.App.Model.eventModel.StatImprovedEvent(improvingInvestigator, improve); // Populate Queue
            GameManager.SingleInstance.App.Controller.queueController.StartCallBackQueue();                    // Start Queue
        }
    }
コード例 #2
0
        private bool TestWasSentOnTime(TestStat startTestData, TestStatDTO endTestData)
        {
            int testDurMin       = startTestData.Test.DurationMin;
            int actualTestDurMin = (endTestData.EndTime - DateTime.Now).Minutes - 1;

            return(actualTestDurMin <= testDurMin);
        }
コード例 #3
0
 public void StartTest(TestStat stat, int testMod, TestType testType, Investigator i, TestCallBack callBack)
 {
     App.Model.testModel.StartTest(stat, testMod, testType, i, callBack);
     App.Controller.queueController.CreateCallBackQueue(FinishPreTestEvent); // Create Queue
     App.Model.eventModel.PreTestEvent();                                    // Populate Queue
     App.Controller.queueController.StartCallBackQueue();                    // Start Queue
 }
コード例 #4
0
    public TheHeartOfAfricaExpeditionEncounter1()
    {
        title             = "The Heart of Africa";
        encounterTexts    = new string[3];
        encounterTexts[0] = "The whole jungle shakes, and the ground splits beneath your feet. You fall through the crevice into a vast subterranean tunnel. \n\r Test Strength";
        encounterTexts[1] = "You follow the tunnel to the ancient city of G'harne. Retreat Doom by 1. If you have read about G'harne, you know to leave quickly \n\r Test Lore \n\r If you fail, you wake up in the jungle with no memory; gain an Amnesia Condition.";
        encounterTexts[2] = "You land painfully on your spine. Lose 1 Health and gain a Back Injury Condition. While you're stuck here, you examine this tunnel \n\r Test Observation -1 \n\r If you pass, you see that it was dug out by a large creature; retreat Doom by 1.";

        testStats    = new TestStat[3];
        testStats[0] = TestStat.Strength;
        testStats[1] = TestStat.Lore;
        testStats[2] = TestStat.Observation;

        testModifiers    = new int[3];
        testModifiers[0] = 0;
        testModifiers[1] = 0;
        testModifiers[2] = -1;

        passTexts    = new string[3];
        passTexts[0] = "";
        passTexts[1] = "Pass";
        passTexts[2] = "Pass \n\r Retreat Doom by 1";

        failTexts    = new string[3];
        failTexts[0] = "";
        failTexts[1] = "Fail \n\r Gain an Amnesia Condition";
        failTexts[2] = "Fail";
    }
コード例 #5
0
    public AntarcticaExpeditionEncounter2()
    {
        title             = "Antarctica";
        encounterTexts    = new string[3];
        encounterTexts[0] = "You hear a faint sound echoing up from the caves that lead down into the darkness. You listen carefully to discern the sound's origin. \n\r Test Observation";
        encounterTexts[1] = "You identify the sound of shoggoths. You escape, but can barely keep yourself conscious waiting for a rescue. \n\r Test Will \n\r If you pass, you spot something on the cave floor; gain 1 Artifact. \n\r If you fail, you pass out and hear the sounds of shoggoth everywhere you go; gain a Hallucinations Condition";
        encounterTexts[2] = "'Tekeli-li! Tekeli-li!' You recognize it too late. The shoggoths overhwelm you! \n\r Test Strength \n\r If you pass, you overcome the threat; gain 2 Clues. If you fail, you escape by jumping off a ledge; gain a Leg Injury Condition.";

        testStats    = new TestStat[3];
        testStats[0] = TestStat.Observation;
        testStats[1] = TestStat.Will;
        testStats[2] = TestStat.Strength;

        testModifiers    = new int[3];
        testModifiers[0] = 0;
        testModifiers[1] = 0;
        testModifiers[2] = -1;

        passTexts    = new string[3];
        passTexts[0] = "";
        passTexts[1] = "Pass \n\r Gain 1 Artifact";
        passTexts[2] = "Pass \n\r Gain 2 Clues";

        failTexts    = new string[3];
        failTexts[0] = "";
        failTexts[1] = "Fail \n\r Gain a Hallucinations Condition";
        failTexts[2] = "Fail \n\r Gain a Leg Injury Condition";
    }
コード例 #6
0
 public void StatImprovedEvent(Investigator i, TestStat stat)
 {
     if (statImprovedEvent != null)
     {
         statImprovedEvent.Invoke(i, stat);
     }
 }
コード例 #7
0
    public ThePyramidsExpeditionEncounter3()
    {
        title             = "The Pyramids";
        encounterTexts    = new string[3];
        encounterTexts[0] = "You reach for the ancient relic when a small white cat jumps in front of you. To your horror, the cat transforms into a demonic, feline creature and attacks \n\r Test Strength";
        encounterTexts[1] = "The demon shrivels down to a husk, leaving the relic unguarded. Gain 1 Artifact. Examining the item, you may be too distracted to notice the warning hieroglyph \n\r Test Observation -1 \n\r If you fail, you aren't prepared to evade the poisoned barb; lose 1 Health";
        encounterTexts[2] = "The creature leaves you badly wounded. Gain a Leg Injury Condition \n\r Test Influence \n\r If you pass, the men who come to find you distract the beast, allowing you to procure the relic; Gain 1 Artifact. \n\r If you fail, lose 1 Health as you have to walk without receiving medical attention.";

        testStats    = new TestStat[3];
        testStats[0] = TestStat.Strength;
        testStats[1] = TestStat.Observation;
        testStats[2] = TestStat.Influence;

        testModifiers    = new int[3];
        testModifiers[0] = 0;
        testModifiers[1] = -1;
        testModifiers[2] = 0;

        passTexts    = new string[3];
        passTexts[0] = "";
        passTexts[1] = "Pass";
        passTexts[2] = "Pass \n\r Gain 1 Artifact";

        failTexts    = new string[3];
        failTexts[0] = "";
        failTexts[1] = "Fail \n\r Lose 1 Health";
        failTexts[2] = "Fail \n\r Lose 2 Health";
    }
コード例 #8
0
    public OtherWorldlyEncounter8()
    {
        title             = "The Future";
        encounterTexts    = new string[3];
        encounterTexts[0] = "You find yourself in a familiar city, but there's no electricity. The only light comes from the greenish moon, and the only sound is distant screaming. You can feel your reason being overrun by fear. \n\r Test Will";
        encounterTexts[1] = "Resisting the urge to panic, you find a large metal and glass machine that has electricty sparkling across its surface. You try to learn how to operate the device. \n\r Test Lore \n\r If you pass, you return to your own time; close this Gate. \n\r If you fail, you receive an electrical shock; lose 2 Health.";
        encounterTexts[2] = "Without thinking, you start walking with a long line of people. You hear screams from the people ahead of you. You try to escape, but the area is being guarded. \n\r Test Strength \n\r If you fail, you return home with no memory of what happened; gain an Amnesia Condition.";

        testStats    = new TestStat[3];
        testStats[0] = TestStat.Will;
        testStats[1] = TestStat.Lore;
        testStats[2] = TestStat.Strength;

        testModifiers    = new int[3];
        testModifiers[0] = 0;
        testModifiers[1] = 0;
        testModifiers[2] = 0;

        passTexts    = new string[3];
        passTexts[0] = "";
        passTexts[1] = "Pass \n\r Close this Gate.";
        passTexts[2] = "Pass";

        failTexts    = new string[3];
        failTexts[0] = "";
        failTexts[1] = "Fail \n\r Lose 2 Health";
        failTexts[2] = "Fail \n\r Gain an Amnesia Condition";
    }
コード例 #9
0
        public virtual TestStat RefreshScenarioStatistics(ITestScenario scenario, bool skipAutomatic)
        {
            var testScenarioStatistics = new TestStat();

            if (null != scenario.TestResults && 0 < scenario.TestResults.Count)
            {
                testScenarioStatistics.All = scenario.TestResults.Count;
                foreach (var testResult in scenario.TestResults)
                {
//                    if (skipAutomatic)
//                        if (TestResultOrigins.Automatic == testResult.Origin)
//                            continue;
                    if (skipAutomatic && TestResultOrigins.Automatic == testResult.Origin)
                    {
                        continue;
                    }

//                    if (testResult.enStatus == TestResultStatuses.Passed || testResult.enStatus == TestResultStatuses.KnownIssue) {
//                        testScenarioStatistics.Passed++;
//                        if (testResult.enStatus == TestResultStatuses.KnownIssue)
//                            testScenarioStatistics.PassedButWithBadSmell++;
//                    }
//                    switch (testResult.enStatus) {
//                        case TestResultStatuses.Passed:
//                        case TestResultStatuses.KnownIssue:
//                            testScenarioStatistics.Passed++;
//                            if (testResult.enStatus == TestResultStatuses.KnownIssue)
//                                testScenarioStatistics.PassedButWithBadSmell++;
//                            break;
//                    }
//                    if (testResult.enStatus == TestResultStatuses.Failed)
//                        testScenarioStatistics.Failed++;

                    switch (testResult.enStatus)
                    {
                    case TestStatuses.Passed:
                        testScenarioStatistics.Passed++;
                        break;

                    case TestStatuses.Failed:
                        testScenarioStatistics.Failed++;
                        break;

                    case TestStatuses.KnownIssue:
                        testScenarioStatistics.PassedButWithBadSmell++;
                        break;
//                        case TestResultStatuses.NotTested:
//                            testScenarioStatistics.NotTested++;
//                            break;
                    }

                    testScenarioStatistics.TimeSpent += testResult.TimeSpent;
                }
            }
            testScenarioStatistics.NotTested = testScenarioStatistics.All - testScenarioStatistics.Passed - testScenarioStatistics.Failed - testScenarioStatistics.PassedButWithBadSmell;
            scenario.Statistics = testScenarioStatistics;
            setTestScenarioStatus(scenario);
            return(testScenarioStatistics);
        }
コード例 #10
0
ファイル: TestScenario.cs プロジェクト: apetrovskiy/STUPS
 public TestScenario()
 {
     UniqueId = Guid.NewGuid();
     TestResults = new List<ITestResult>();
     TestCases = new List<ITestCase>();
     Statistics = new TestStat();
     enStatus = TestStatuses.NotRun;
 }
コード例 #11
0
ファイル: StaticEx.cs プロジェクト: sohamglobal/csharp
    public static void Main()
    {
        TestStat ts = new TestStat();

        ts.Show();
//ts.Display()	not allowed
        TestStat.Display();
    }
コード例 #12
0
ファイル: TestStatistics.cs プロジェクト: MatkoHanus/STUPS
        public virtual TestStat RefreshScenarioStatistics(ITestScenario scenario, bool skipAutomatic)
        {
            var testScenarioStatistics = new TestStat();
            
            if (null != scenario.TestResults && 0 < scenario.TestResults.Count) {
                
                testScenarioStatistics.All = scenario.TestResults.Count;
                foreach (var testResult in scenario.TestResults) {
//                    if (skipAutomatic)
//                        if (TestResultOrigins.Automatic == testResult.Origin)
//                            continue;
                    if (skipAutomatic && TestResultOrigins.Automatic == testResult.Origin)
                        continue;
                    
//                    if (testResult.enStatus == TestResultStatuses.Passed || testResult.enStatus == TestResultStatuses.KnownIssue) {
//                        testScenarioStatistics.Passed++;
//                        if (testResult.enStatus == TestResultStatuses.KnownIssue)
//                            testScenarioStatistics.PassedButWithBadSmell++;
//                    }
//                    switch (testResult.enStatus) {
//                        case TestResultStatuses.Passed:
//                        case TestResultStatuses.KnownIssue:
//                            testScenarioStatistics.Passed++;
//                            if (testResult.enStatus == TestResultStatuses.KnownIssue)
//                                testScenarioStatistics.PassedButWithBadSmell++;
//                            break;
//                    }
//                    if (testResult.enStatus == TestResultStatuses.Failed)
//                        testScenarioStatistics.Failed++;
                    
                    // 20150219
                    switch (testResult.enStatus) {
                        case TestResultStatuses.Passed:
                            testScenarioStatistics.Passed++;
                            break;
                        case TestResultStatuses.Failed:
                            testScenarioStatistics.Failed++;
                            break;
                        case TestResultStatuses.KnownIssue:
                            testScenarioStatistics.PassedButWithBadSmell++;
                            break;
//                        case TestResultStatuses.NotTested:
//                            testScenarioStatistics.NotTested++;
//                            break;
                    }
                    
                    testScenarioStatistics.TimeSpent += testResult.TimeSpent;
                }
            }
            // 20150219
            // testScenarioStatistics.NotTested = testScenarioStatistics.All - testScenarioStatistics.Passed - testScenarioStatistics.Failed;
            testScenarioStatistics.NotTested = testScenarioStatistics.All - testScenarioStatistics.Passed - testScenarioStatistics.Failed -testScenarioStatistics.PassedButWithBadSmell;
            scenario.Statistics = testScenarioStatistics;
            setTestScenarioStatus(scenario);
            return testScenarioStatistics;
        }
コード例 #13
0
ファイル: TestSuite.cs プロジェクト: apetrovskiy/STUPS
 public TestSuite()
 {
     UniqueId = Guid.NewGuid();
     TestScenarios = new List<ITestScenario>();
     Statistics = new TestStat();
     enStatus = TestStatuses.NotRun;
     Id = TestData.GetTestSuiteId();
     addDefaultPlatform();
     SetNow();
 }
コード例 #14
0
        public void StartTest(TestStatDTO startTestData)
        {
            _unitOfWork.TestStatistics.DeleteNotFinishedTestStatisticsByUserId(startTestData.UserId);

            startTestData.StartTime = DateTime.Now;
            TestStat stat = _mapper.Map <TestStat>(startTestData);

            _unitOfWork.TestStatistics.Add(stat);
            _unitOfWork.SaveChanges();
        }
コード例 #15
0
ファイル: TestScenario.cs プロジェクト: apetrovskiy/STUPS
        // 20141102
//            try{
//                if (TestData.CurrentTestResult.Details.Count > 0) {
//                    
//                    TestData.AddTestResult(
//                        "autoclosed", 
//                        TestData.GetTestResultId(), 
//                        null, 
//                        false, // isKnownIssue
//                        false, // generateNextResult
//                        null, // MyInvocation
//                        null, // Error
//                        string.Empty,
//                        TestResultOrigins.Automatic,
//                        false);
//                } else {
//                    TestData.CurrentTestResult = null;
//                }
//            }
//            catch {}
//            
//            this.SetNow();
//            
//            // in detail 20140713
//            var testSuite1 = TestData.TestSuites[TestData.TestSuites.Count - 1];
//            var testScenario1 = testSuite1.TestScenarios[testSuite1.TestScenarios.Count - 1]; // HERE!!
//            string testScenarioId1 = testScenario1.Id;
//            // string testScenarioId1 = TestData.TestSuites[TestData.TestSuites.Count - 1].TestScenarios[TestData.TestSuites[TestData.TestSuites.Count - 1].TestScenarios.Count - 1].Id;
//            string testSuiteId1 = TestData.TestSuites[TestData.TestSuites.Count - 1].Id;
//            // 20140723
//            // var testResult1 = new TestResult(testScenarioId1, testSuiteId1);
//            // this.TestResults.Add(testResult1);
//            this.TestResults.Add(new TestResult(testScenarioId1, testSuiteId1)); // ??
////            this.TestResults.Add(
////                new TestResult(
////                    TestData.TestSuites[TestData.TestSuites.Count - 1].TestScenarios[TestData.TestSuites[TestData.TestSuites.Count - 1].TestScenarios.Count - 1].Id, // "???",
////                    TestData.TestSuites[TestData.TestSuites.Count - 1].Id)); // "???"));
//            TestData.CurrentTestResult = this.TestResults[TestResults.Count - 1];
//        }
        
        public TestScenario(
            string testScenarioName, 
            string testScenarioId,
            string testSuiteId)
        {
            UniqueId = Guid.NewGuid();
            TestResults = new List<ITestResult>();
            TestCases = new List<ITestCase>();
            Statistics = new TestStat();
            enStatus = TestStatuses.NotRun;
            Name = testScenarioName;
            Id = !string.IsNullOrEmpty(testScenarioId) ? testScenarioId : TestData.GetTestScenarioId();
            SuiteId = testSuiteId;
            
            try{
                if (TestData.CurrentTestResult.Details.Count > 0) {
                    TestData.AddTestResult(
                        "autoclosed", 
                        TestData.GetTestResultId(), 
                        null, 
                        false, // isKnownIssue
                        false, // generateNextResult
                        // 20160116
                        // null, // MyInvocation
                        null, // Error
                        string.Empty,
                        TestResultOrigins.Automatic,
                        false);
                } else {
                    TestData.CurrentTestResult = null;
                }
            }
            catch {}
            
            SetNow();
            TestResults.Add(
                new TestResult(
                   Id,
                   SuiteId));
            
            try {
                if ((null != TestData.CurrentTestResult.Name ||
                    null != TestData.CurrentTestResult.Id) &&
                    null != TestData.CurrentTestResult.Details &&
                    0 < TestData.CurrentTestResult.Details.Count) {
                    
                    TestData.CurrentTestScenario.TestResults.Add(TestData.CurrentTestResult);
                }
            }
            catch (Exception) {
                //Console.WriteLine(eeeee.Message);
            }
            TestData.CurrentTestResult = 
                TestResults[TestResults.Count - 1];
        }
コード例 #16
0
 public MultipleOptionMenuObject(MultipleOptionType type, Spell s)
 {
     text         = "";
     objectType   = type;
     monster      = null;
     asset        = null;
     investigator = null;
     stat         = TestStat.None;
     reckoning    = new ReckoningEvent();
     spell        = s;
 }
コード例 #17
0
    public void StartSingleRollTest(Investigator i, TestCallBack callBack)
    {
        activeTestStat      = TestStat.None;
        activeTestType      = TestType.SingleRoll;
        testingInvestigator = i;
        currentCallBack     = callBack;
        currentNumRolls     = 1;
        currentResults      = new List <int>();

        App.View.testView.SingleRollTestStarted();
    }
コード例 #18
0
ファイル: TestSuite.cs プロジェクト: apetrovskiy/STUPS
 public TestSuite(string testSuiteName, string testSuiteId)
 {
     UniqueId = Guid.NewGuid();
     TestScenarios = new List<ITestScenario> ();
     Statistics = new TestStat();
     enStatus = TestStatuses.NotRun;
     Name = testSuiteName;
     Id = testSuiteId != string.Empty ? testSuiteId : TestData.GetTestSuiteId();
     addDefaultPlatform();
     SetNow();
 }
コード例 #19
0
ファイル: Program.cs プロジェクト: bmdub/AutoStat
            internal TestComparedStat(string memberName, TestStat stat1, TestStat stat2)
            {
                MemberName = memberName;
                Stat1      = stat1;
                Stat2      = stat2;

                DiffPct     = (double)(stat1.Count - stat2.Count) / stat2.Count;
                IsDifferent = DiffPct != 0;

                StringValue = this.FormatComparedStats();
            }
コード例 #20
0
    public void StartTest(TestStat stat, int testMod, TestType testType, Investigator i, TestCallBack callBack)
    {
        activeTestStat       = stat;
        activeTestMod        = testMod;
        activeTestType       = testType;
        testingInvestigator  = i;
        currentCallBack      = callBack;
        currentAdditionalDie = 0;
        currentBonus         = 0;
        currentResults       = new List <int>();

        App.View.testView.PreTest();
    }
コード例 #21
0
ファイル: TestStatistics.cs プロジェクト: MatkoHanus/STUPS
 public virtual TestStat RefreshAllStatistics(List<ITestSuite> suites, bool skipAutomatic)
 {
     var testAllStatistics = new TestStat();
     foreach (var testSuite in suites) {
         RefreshSuiteStatistics(testSuite, skipAutomatic);
         testAllStatistics.All += testSuite.Statistics.All;
         testAllStatistics.Passed += testSuite.Statistics.Passed;
         testAllStatistics.Failed += testSuite.Statistics.Failed;
         testAllStatistics.NotTested += testSuite.Statistics.NotTested;
         testAllStatistics.TimeSpent += testSuite.Statistics.TimeSpent;
         testAllStatistics.PassedButWithBadSmell += testSuite.Statistics.PassedButWithBadSmell;
     }
     return testAllStatistics;
 }
コード例 #22
0
        public virtual TestStat RefreshAllStatistics(List <ITestSuite> suites, bool skipAutomatic)
        {
            var testAllStatistics = new TestStat();

            foreach (var testSuite in suites)
            {
                RefreshSuiteStatistics(testSuite, skipAutomatic);
                testAllStatistics.All                   += testSuite.Statistics.All;
                testAllStatistics.Passed                += testSuite.Statistics.Passed;
                testAllStatistics.Failed                += testSuite.Statistics.Failed;
                testAllStatistics.NotTested             += testSuite.Statistics.NotTested;
                testAllStatistics.TimeSpent             += testSuite.Statistics.TimeSpent;
                testAllStatistics.PassedButWithBadSmell += testSuite.Statistics.PassedButWithBadSmell;
            }
            return(testAllStatistics);
        }
コード例 #23
0
        public void SaveCompletedTest(TestStatDTO endTestData)
        {
            endTestData.Result = this.CalculateTestResult(endTestData);

            TestStat startedTestData = _unitOfWork.TestStatistics.GetNotFinishedTestByUserId(endTestData.UserId);

            if (this.TestWasSentOnTime(startedTestData, endTestData))
            {
                startedTestData.Result  = endTestData.Result;
                startedTestData.EndTime = DateTime.Now;
                startedTestData.Answers = _mapper.Map <ICollection <Answer> >(endTestData.Answers);

                _unitOfWork.TestStatistics.Update(startedTestData);
                _unitOfWork.SaveChanges();
            }
        }
コード例 #24
0
ファイル: TestStatistics.cs プロジェクト: MatkoHanus/STUPS
 public virtual TestStat RefreshSuiteStatistics(ITestSuite suite, bool skipAutomatic)
 {
     var testSuiteStatistics = new TestStat();
     foreach (var testScenario in suite.TestScenarios) {
         RefreshScenarioStatistics(testScenario, skipAutomatic);
         testSuiteStatistics.All += testScenario.Statistics.All;
         testSuiteStatistics.Passed += testScenario.Statistics.Passed;
         testSuiteStatistics.Failed += testScenario.Statistics.Failed;
         testSuiteStatistics.NotTested += testScenario.Statistics.NotTested;
         testSuiteStatistics.TimeSpent += testScenario.Statistics.TimeSpent;
         testSuiteStatistics.PassedButWithBadSmell += testScenario.Statistics.PassedButWithBadSmell;
     }
     suite.Statistics = testSuiteStatistics;
     setTestSuiteStatus(suite);
     return testSuiteStatistics;
 }
コード例 #25
0
    public YigCultist2()
    {
        monsterName   = "Cultist";
        toughness     = 2;
        horror        = 2;
        damage        = 3;
        monsterText   = "If you lose Health from the strength test, you've been bitten by the snake-like creature; gain a Poisoned Condition.";
        reckoningText = "";

        tests    = new TestStat[2];
        tests[0] = TestStat.Will;
        tests[1] = TestStat.Strength;

        testMods    = new int[2];
        testMods[0] = 0;
        testMods[1] = -1;
    }
コード例 #26
0
    public CthuluCultist1()
    {
        monsterName   = "Cultist";
        toughness     = 1;
        horror        = 0;
        damage        = 1;
        monsterText   = "Before resolving the Strength test, lose 1 Sanity.";
        reckoningText = "";

        tests    = new TestStat[2];
        tests[0] = TestStat.None;
        tests[1] = TestStat.Strength;

        testMods    = new int[2];
        testMods[0] = 0;
        testMods[1] = 0;
    }
コード例 #27
0
    public GhoulMonster()
    {
        monsterName   = "Ghoul";
        toughness     = 1;
        horror        = 1;
        damage        = 2;
        monsterText   = "If you take damage from the Strength test, gain a Paranoia Condition";
        reckoningText = "";
        monsterSprite = GameManager.SingleInstance.App.Model.monsterSpritesModel.ghoulSprite;

        tests    = new TestStat[2];
        tests[0] = TestStat.Will;
        tests[1] = TestStat.Strength;

        testMods    = new int[2];
        testMods[0] = 1;
        testMods[1] = 0;
    }
コード例 #28
0
        public virtual TestStat RefreshSuiteStatistics(ITestSuite suite, bool skipAutomatic)
        {
            var testSuiteStatistics = new TestStat();

            foreach (var testScenario in suite.TestScenarios)
            {
                RefreshScenarioStatistics(testScenario, skipAutomatic);
                testSuiteStatistics.All                   += testScenario.Statistics.All;
                testSuiteStatistics.Passed                += testScenario.Statistics.Passed;
                testSuiteStatistics.Failed                += testScenario.Statistics.Failed;
                testSuiteStatistics.NotTested             += testScenario.Statistics.NotTested;
                testSuiteStatistics.TimeSpent             += testScenario.Statistics.TimeSpent;
                testSuiteStatistics.PassedButWithBadSmell += testScenario.Statistics.PassedButWithBadSmell;
            }
            suite.Statistics = testSuiteStatistics;
            setTestSuiteStatus(suite);
            return(testSuiteStatistics);
        }
コード例 #29
0
    public CthuluEpicMonster()
    {
        monsterName   = "Cthulu";
        epic          = true;
        toughness     = 1;
        horror        = 5;
        damage        = 4;
        monsterText   = "If you lose Sanity from the Will test, place the lost Sanity on the Ancient One sheet. \n\r Toughness is equal to the Number of Investigators + 3";
        reckoningText = "";
        monsterSprite = GameManager.SingleInstance.App.Model.ancientOneSpritesModel.cthuluSprite;

        tests    = new TestStat[2];
        tests[0] = TestStat.Will;
        tests[1] = TestStat.Strength;

        testMods    = new int[2];
        testMods[0] = -2;
        testMods[1] = -2;
    }
コード例 #30
0
        protected override void BeginProcessing()
        {
            TestStat stat = new TestStat();

            if (null != TMX.TestData.TestSuites && 0 < TMX.TestData.TestSuites.Count) {

                foreach (TestSuite testSuite in TMX.TestData.TestSuites) {

                    TMX.TestData.RefreshSuiteStatistics(testSuite, false);
                    stat.Passed += testSuite.Statistics.Passed;
                    stat.Failed += testSuite.Statistics.Failed;
                    stat.PassedButWithBadSmell += testSuite.Statistics.PassedButWithBadSmell;
                    stat.NotTested += testSuite.Statistics.NotTested;
                    stat.All += testSuite.Statistics.All;
                }

            }

            this.WriteObject(this, stat);
        }
コード例 #31
0
 public void ImpairStat(TestStat stat)
 {
     if (stat == TestStat.Influence)
     {
         influenceMod--;
     }
     if (stat == TestStat.Lore)
     {
         loreMod--;
     }
     if (stat == TestStat.Observation)
     {
         observationMod--;
     }
     if (stat == TestStat.Strength)
     {
         strengthMod--;
     }
     if (stat == TestStat.Will)
     {
         willMod--;
     }
     App.Controller.previewedInvestigatorController.UpdateInvestigator();
 }
コード例 #32
0
 public int CheckMod(TestStat stat)
 {
     if (stat == TestStat.Influence)
     {
         return(influenceMod);
     }
     if (stat == TestStat.Lore)
     {
         return(loreMod);
     }
     if (stat == TestStat.Observation)
     {
         return(observationMod);
     }
     if (stat == TestStat.Strength)
     {
         return(strengthMod);
     }
     if (stat == TestStat.Will)
     {
         return(willMod);
     }
     return(0);
 }
コード例 #33
0
ファイル: TestData.cs プロジェクト: JosefNemec/STUPS
        // 20130322
        //internal static TestStat RefreshScenarioStatistics(TestScenario scenario)
        internal static TestStat RefreshScenarioStatistics(TestScenario scenario, bool skipAutomatic)
        {
            TestStat ts = new TestStat();

            if (null != scenario.TestResults && 0 < scenario.TestResults.Count) {

                ts.All = scenario.TestResults.Count;
                foreach (TestResult tr in scenario.TestResults) {

                    // 20130322
                    if (skipAutomatic) {
                        if (TestResultOrigins.Automatic == tr.Origin) {
                            continue;
                        }
                    }

                    if (tr.enStatus == TestResultStatuses.Passed ||
                        tr.enStatus == TestResultStatuses.KnownIssue) {
                        ts.Passed++;
                        if (tr.enStatus == TestResultStatuses.KnownIssue){
                            ts.PassedButWithBadSmell++;
                        }
                    }
                    if (tr.enStatus == TestResultStatuses.Failed) {
                        ts.Failed++;
                    }
                    ts.TimeSpent += tr.TimeSpent;
                }
            }
            ts.NotTested =
                ts.All -
                ts.Passed -
                ts.Failed;
            scenario.Statistics = ts;
            return ts;
        }
コード例 #34
0
ファイル: TestData.cs プロジェクト: JosefNemec/STUPS
        internal static TestStat RefreshSuiteStatistics(TestSuite suite, bool skipAutomatic)
        {
            TestStat ts = new TestStat();
            foreach (TestScenario tsc in suite.TestScenarios) {

                // 20130322
                //RefreshScenarioStatistics(tsc);
                RefreshScenarioStatistics(tsc, skipAutomatic);
                ts.All += tsc.Statistics.All;
                ts.Passed += tsc.Statistics.Passed;
                ts.Failed += tsc.Statistics.Failed;
                ts.NotTested += tsc.Statistics.NotTested;
                ts.TimeSpent += tsc.Statistics.TimeSpent;
                ts.PassedButWithBadSmell += tsc.Statistics.PassedButWithBadSmell;
            }
            suite.Statistics = ts;
            return ts;
        }
コード例 #35
0
    public void MultipleOptionStarted()
    {
        multipleOptionMenu.SetActive(true);
        App.Controller.openMenuController.OpenMenu(multipleOptionMenu);

        menuTitle.text = App.Model.multipleOptionModel.menuTitle;

        foreach (Transform child in optionsList.transform)
        {
            Destroy(child.gameObject);
        }

        for (int i = 0; i < App.Model.multipleOptionModel.currentOptions.Count; i++)
        {
            MultipleOptionMenuObject o = App.Model.multipleOptionModel.currentOptions[i];
            if (o.objectType == MultipleOptionType.Text)
            {
                GameObject go = Instantiate(textOption, optionsList.transform);
                go.GetComponentInChildren <Text>().text = o.text;
                int copy = i;
                go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
            }
            if (o.objectType == MultipleOptionType.Monster)
            {
                GameObject go = Instantiate(monsterOption, optionsList.transform);
                go.GetComponent <Image>().sprite = o.monster.monsterSprite;                              // Portrait
                go.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = o.monster.monsterName; // Name
                if (o.monster.damageTaken == 0)                                                          // No Taken Damage
                {
                    go.transform.GetChild(0).GetChild(1).gameObject.SetActive(false);
                }
                else // Some Taken Damage
                {
                    go.transform.GetChild(0).GetChild(1).gameObject.SetActive(true);
                    go.transform.GetChild(0).GetChild(1).GetChild(0).GetComponent <Text>().text = "" + o.monster.damageTaken;
                }
                go.transform.GetChild(0).GetChild(2).GetComponent <Text>().text = "" + o.monster.toughness; // Toughness
                if (o.monster.tests[0] == TestStat.None)                                                    // No Test 1
                {
                    go.transform.GetChild(0).GetChild(3).GetChild(0).GetComponent <Image>().sprite = App.Model.gameSpritesModel.GetTestStatSprite(TestStat.None);
                    go.transform.GetChild(0).GetChild(3).GetChild(1).GetComponent <Text>().text    = "";
                    go.transform.GetChild(0).GetChild(3).GetChild(2).GetComponent <Text>().text    = "";
                    go.transform.GetChild(0).GetChild(3).GetChild(3).GetComponent <Image>().sprite = App.Model.gameSpritesModel.GetTestStatSprite(TestStat.None);
                }
                else // Test 1
                {
                    go.transform.GetChild(0).GetChild(3).GetChild(0).GetComponent <Image>().sprite = App.Model.gameSpritesModel.GetTestStatSprite(o.monster.tests[0]);
                    if (o.monster.testMods[0] == 0)
                    {
                        go.transform.GetChild(0).GetChild(3).GetChild(1).GetComponent <Text>().text = "";
                    }
                    else
                    {
                        go.transform.GetChild(0).GetChild(3).GetChild(1).GetComponent <Text>().text = "" + o.monster.testMods[0];
                    }
                    go.transform.GetChild(0).GetChild(3).GetChild(2).GetComponent <Text>().text    = "" + o.monster.horror;
                    go.transform.GetChild(0).GetChild(3).GetChild(3).GetComponent <Image>().sprite = App.Model.gameSpritesModel.sanitySprite;
                }
                if (o.monster.tests[1] == TestStat.None) // No Test 2
                {
                    go.transform.GetChild(0).GetChild(4).GetChild(0).GetComponent <Image>().sprite = App.Model.gameSpritesModel.GetTestStatSprite(TestStat.None);
                    go.transform.GetChild(0).GetChild(4).GetChild(1).GetComponent <Text>().text    = "";
                    go.transform.GetChild(0).GetChild(4).GetChild(2).GetComponent <Text>().text    = "";
                    go.transform.GetChild(0).GetChild(4).GetChild(3).GetComponent <Image>().sprite = App.Model.gameSpritesModel.GetTestStatSprite(TestStat.None);
                }
                else // Test 2
                {
                    go.transform.GetChild(0).GetChild(4).GetChild(0).GetComponent <Image>().sprite = App.Model.gameSpritesModel.GetTestStatSprite(o.monster.tests[1]);
                    if (o.monster.testMods[1] == 0)
                    {
                        go.transform.GetChild(0).GetChild(4).GetChild(1).GetComponent <Text>().text = "";
                    }
                    else
                    {
                        go.transform.GetChild(0).GetChild(4).GetChild(1).GetComponent <Text>().text = "" + o.monster.testMods[1];
                    }
                    go.transform.GetChild(0).GetChild(4).GetChild(2).GetComponent <Text>().text    = "" + o.monster.damage;
                    go.transform.GetChild(0).GetChild(4).GetChild(3).GetComponent <Image>().sprite = App.Model.gameSpritesModel.healthSprite;
                }
                go.transform.GetChild(0).GetChild(5).GetComponent <Text>().text = o.monster.monsterText; // Monster Text
                if (o.monster.reckoningText == "")                                                       // No Reckoning
                {
                    go.transform.GetChild(0).GetChild(6).gameObject.SetActive(false);
                }
                else // Reckoning
                {
                    go.transform.GetChild(0).GetChild(6).gameObject.SetActive(true);
                    go.transform.GetChild(0).GetChild(6).GetChild(0).GetComponent <Text>().text = o.monster.reckoningText;
                }
                // Set onclick
                int copy = i;
                go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
            }
            else if (o.objectType == MultipleOptionType.Investigator)
            {
                GameObject   go  = Instantiate(investigatorOption, optionsList.transform);
                Investigator inv = o.investigator;
                go.GetComponent <Image>().sprite        = inv.investigatorPortrait;
                go.GetComponentInChildren <Text>().text = inv.investigatorName;

                // Set onclick
                int copy = i;
                go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
            }
            else if (o.objectType == MultipleOptionType.Stat)
            {
                GameObject go   = Instantiate(statOption, optionsList.transform);
                TestStat   stat = o.stat;
                go.GetComponent <Image>().sprite        = App.Model.gameSpritesModel.GetTestStatSprite(stat);
                go.GetComponentInChildren <Text>().text = "" + stat;

                // Set onclick
                int copy = i;
                go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
            }
            else if (o.objectType == MultipleOptionType.Reckoning)
            {
                ReckoningEvent re = o.reckoning;
                if (re.source == ReckoningSource.AncientOne)
                {
                    GameObject go = Instantiate(ancientOneReckoningOption, optionsList.transform);
                    go.GetComponent <Image>().sprite = re.icon;
                    go.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = re.title;
                    go.transform.GetChild(0).GetChild(1).GetComponent <Text>().text = re.text;
                    int copy = i;
                    go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
                }
                if (re.source == ReckoningSource.Ongoing)
                {
                    GameObject go = Instantiate(ongoingEffectReckoningOption, optionsList.transform);
                    go.GetComponent <Image>().sprite = re.icon;
                    go.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = re.title;
                    go.transform.GetChild(0).GetChild(1).GetComponent <Text>().text = re.text;
                    int copy = i;
                    go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
                }
                if (re.source == ReckoningSource.Investigator)
                {
                    GameObject go = Instantiate(investigatorReckoningOption, optionsList.transform);
                    go.GetComponent <Image>().sprite = re.icon;
                    go.transform.GetChild(0).GetChild(0).GetComponent <Text>().text    = re.title;
                    go.transform.GetChild(0).GetChild(1).GetComponent <Text>().text    = re.text;
                    go.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = re.investigator.investigatorPortrait;
                    int copy = i;
                    go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
                }
            }
            else if (o.objectType == MultipleOptionType.AssetEvent)
            {
                GameObject go = Instantiate(eventOption, optionsList.transform);
                Asset      a  = o.asset;
                go.GetComponent <Image>().sprite = a.assetPortrait;
                go.transform.GetChild(0).GetChild(0).GetComponent <Text>().text    = a.ownedInvestigator.investigatorName + "'s " + a.assetName;
                go.transform.GetChild(0).GetChild(1).GetComponent <Text>().text    = a.text;
                go.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = a.ownedInvestigator.investigatorPortrait;
                int copy = i;
                go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
            }
            else if (o.objectType == MultipleOptionType.SpellEvent)
            {
                GameObject go = Instantiate(eventOption, optionsList.transform);
                Spell      s  = o.spell;
                go.GetComponent <Image>().sprite = s.spellPortrait;
                go.transform.GetChild(0).GetChild(0).GetComponent <Text>().text    = s.owner.investigatorName + "'s " + s.spellName;
                go.transform.GetChild(0).GetChild(1).GetComponent <Text>().text    = s.text;
                go.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = s.owner.investigatorPortrait;
                int copy = i;
                go.GetComponent <Button>().onClick.AddListener(delegate { App.Controller.multipleOptionController.SelectOption(copy); });
            }
        }
    }
コード例 #36
0
 string getStatisticsStringOverall()
 {
     string result = string.Empty;
     var ts = new TestStat();
     
     int suPassed = 0;
     int suFailed = 0;
     int suNotTested = 0;
     // 20150114
     int suKnownIssue = 0;
     int scPassed = 0;
     int scFailed = 0;
     int scNotTested = 0;
     // 20150114
     int scKnownIssue = 0;
     
     foreach (var tsuite in TestData.TestSuites) {
         ts.All += tsuite.Statistics.All;
         ts.Passed += tsuite.Statistics.Passed;
         ts.Failed += tsuite.Statistics.Failed;
         ts.NotTested += tsuite.Statistics.NotTested;
         ts.TimeSpent += tsuite.Statistics.TimeSpent;
         ts.PassedButWithBadSmell += tsuite.Statistics.PassedButWithBadSmell;
         
         switch (tsuite.enStatus) {
             case TestStatuses.Passed:
                 suPassed++;
                 break;
             case TestStatuses.Failed:
                 suFailed++;
                 break;
             case TestStatuses.NotRun:
                 suNotTested++;
                 break;
             case TestStatuses.KnownIssue:
                 suKnownIssue++;
                 break;
             default:
                 throw new Exception("Invalid value for TestSuiteStatuses");
         }
         
         foreach (var tsc in tsuite.TestScenarios) {
             switch (tsc.enStatus) {
                 case TestStatuses.Passed:
                     scPassed++;
                     break;
                 case TestStatuses.Failed:
                     scFailed++;
                     break;
                 case TestStatuses.NotRun:
                     scNotTested++;
                     break;
                 case TestStatuses.KnownIssue:
                     scKnownIssue++;
                     break;
                 default:
                     // 20130428
                     //throw new Exception("Invalid value for TestScenarioStatuses");
                     scNotTested++;
                     break;
             }
         }
     }
     
     result += @"<div id=""overallstat"">";
     
     // suites
     result += @"Suites:";
     result += (suPassed + suFailed + suNotTested).ToString();
     result += "  Passed:";
     result += suPassed.ToString();
     result += "  Failed:";
     result += suFailed.ToString();
     result += "  Not tested:";
     result += suNotTested.ToString();
     result += newLineHTML;
     
     // scenarios
     result += @"Scenarios:";
     result += (scPassed + scFailed + scNotTested).ToString();
     result += "  Passed:";
     result += scPassed.ToString();
     result += "  Failed:";
     result += scFailed.ToString();
     result += "  Not tested:";
     result += scNotTested.ToString();
     result += newLineHTML;
     
     // test results
     result += @"Test cases:";
     result += ts.All.ToString();
     result += "  Passed:";
     result += ts.Passed.ToString();
     result += "  Failed:";
     result += ts.Failed.ToString();
     result += "  Not tested:";
     result += ts.NotTested.ToString();
     result += "  Time spent:";
     result += Convert.ToInt32(ts.TimeSpent).ToString();
     result += @" seconds";
     
     if (ts.PassedButWithBadSmell > 0){
         result += newLineHTML;
         
         // bad smell test resutls
         result += ts.PassedButWithBadSmell.ToString();
         result += @" cases of non-critical issues are counted as Passed";
     }
     
     result += @"</div>";
     
     return result;
 }
コード例 #37
0
        string getStatisticsStringOverall()
        {
            string result = string.Empty;
            var    ts     = new TestStat();

            int suPassed    = 0;
            int suFailed    = 0;
            int suNotTested = 0;
            // 20150114
            int suKnownIssue = 0;
            int scPassed     = 0;
            int scFailed     = 0;
            int scNotTested  = 0;
            // 20150114
            int scKnownIssue = 0;

            foreach (var tsuite in TestData.TestSuites)
            {
                ts.All                   += tsuite.Statistics.All;
                ts.Passed                += tsuite.Statistics.Passed;
                ts.Failed                += tsuite.Statistics.Failed;
                ts.NotTested             += tsuite.Statistics.NotTested;
                ts.TimeSpent             += tsuite.Statistics.TimeSpent;
                ts.PassedButWithBadSmell += tsuite.Statistics.PassedButWithBadSmell;

                switch (tsuite.enStatus)
                {
                case TestStatuses.Passed:
                    suPassed++;
                    break;

                case TestStatuses.Failed:
                    suFailed++;
                    break;

                case TestStatuses.NotRun:
                    suNotTested++;
                    break;

                case TestStatuses.KnownIssue:
                    suKnownIssue++;
                    break;

                default:
                    throw new Exception("Invalid value for TestSuiteStatuses");
                }

                foreach (var tsc in tsuite.TestScenarios)
                {
                    switch (tsc.enStatus)
                    {
                    case TestStatuses.Passed:
                        scPassed++;
                        break;

                    case TestStatuses.Failed:
                        scFailed++;
                        break;

                    case TestStatuses.NotRun:
                        scNotTested++;
                        break;

                    case TestStatuses.KnownIssue:
                        scKnownIssue++;
                        break;

                    default:
                        // 20130428
                        //throw new Exception("Invalid value for TestScenarioStatuses");
                        scNotTested++;
                        break;
                    }
                }
            }

            result += @"<div id=""overallstat"">";

            // suites
            result += @"Suites:";
            result += (suPassed + suFailed + suNotTested).ToString();
            result += "  Passed:";
            result += suPassed.ToString();
            result += "  Failed:";
            result += suFailed.ToString();
            result += "  Not tested:";
            result += suNotTested.ToString();
            result += newLineHTML;

            // scenarios
            result += @"Scenarios:";
            result += (scPassed + scFailed + scNotTested).ToString();
            result += "  Passed:";
            result += scPassed.ToString();
            result += "  Failed:";
            result += scFailed.ToString();
            result += "  Not tested:";
            result += scNotTested.ToString();
            result += newLineHTML;

            // test results
            result += @"Test cases:";
            result += ts.All.ToString();
            result += "  Passed:";
            result += ts.Passed.ToString();
            result += "  Failed:";
            result += ts.Failed.ToString();
            result += "  Not tested:";
            result += ts.NotTested.ToString();
            result += "  Time spent:";
            result += Convert.ToInt32(ts.TimeSpent).ToString();
            result += @" seconds";

            if (ts.PassedButWithBadSmell > 0)
            {
                result += newLineHTML;

                // bad smell test resutls
                result += ts.PassedButWithBadSmell.ToString();
                result += @" cases of non-critical issues are counted as Passed";
            }

            result += @"</div>";

            return(result);
        }
コード例 #38
0
 public Sprite GetTestStatSprite(TestStat stat)
 {
     return(testStatSprites[stat]);
 }