Example #1
0
        public void GetStressTestResultTest()
        {
            StressTestCase target = new StressTestCase();
            TestCaseResult actual = target.GetStressTestResult();

            Assert.IsTrue(actual.Result == TestResult.Pass);
            Assert.IsTrue(actual.ReasonForFailure == null);
        }
Example #2
0
        public void GetStressTestResultTest()
        {
            StressTestCase target = new StressTestCase();

            Assert.IsFalse(target.GetStressTestResult().HasValue);
            target.PerformStressTest();
            Assert.IsTrue(target.GetStressTestResult().HasValue);
        }
Example #3
0
        public void ToStringTest()
        {
            StressTestCase target   = new StressTestCase();
            string         expected = "Material: StainlessSteel, CrossSection: IBeam, Length: 4000mm, Height: 20mm, Width: 15mm";
            string         actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void StressTestCaseConstructorTest1()
        {
            StressTestCase target = new StressTestCase();

            Assert.AreEqual(Material.StainlessSteel, target.GirderMaterial);
            Assert.AreEqual(CrossSection.IBeam, target.CrossSection);
            Assert.AreEqual(4000, target.LengthInMm);
            Assert.AreEqual(20, target.HeightInMm);
            Assert.AreEqual(15, target.WidthInMm);
        }
Example #5
0
        public void StressTestCaseConstructorTest()
        {
            Material       girderMaterial = Material.Composite;
            CrossSection   crossSection   = CrossSection.CShaped;
            int            lengthInMm     = 5000;
            int            heightInMm     = 32;
            int            widthInMm      = 18;
            StressTestCase target         = new StressTestCase(girderMaterial, crossSection, lengthInMm, heightInMm, widthInMm);

            Assert.AreEqual(Material.Composite, target.GirderMaterial);
            Assert.AreEqual(CrossSection.CShaped, target.CrossSection);
            Assert.AreEqual(5000, target.LengthInMm);
            Assert.AreEqual(32, target.HeightInMm);
            Assert.AreEqual(18, target.WidthInMm);
        }
Example #6
0
        /// <summary>
        /// Create some sample stress tests
        /// </summary>
        /// <returns>Array of Stress Test Cases</returns>
        private StressTestCase[] CreateTestCases()
        {
            StressTestCase[] stressTestCases = new StressTestCase[10];

            stressTestCases[0] = new StressTestCase();
            stressTestCases[1] = new StressTestCase(Material.Composite, CrossSection.CShaped, 3500, 100, 20);
            stressTestCases[2] = new StressTestCase();
            stressTestCases[3] = new StressTestCase(Material.Aluminium, CrossSection.Box, 3500, 100, 20);
            stressTestCases[4] = new StressTestCase();
            stressTestCases[5] = new StressTestCase(Material.Titanium, CrossSection.CShaped, 3600, 150, 20);
            stressTestCases[6] = new StressTestCase(Material.Titanium, CrossSection.ZShaped, 4000, 80, 20);
            stressTestCases[7] = new StressTestCase(Material.Titanium, CrossSection.Box, 5000, 90, 20);
            stressTestCases[8] = new StressTestCase();
            stressTestCases[9] = new StressTestCase(Material.StainlessSteel, CrossSection.Box, 3500, 100, 20);

            return(stressTestCases);
        }
Example #7
0
 public void PerformStressTestTest()
 {
     for (int i = 0; i < 30; i++)
     {
         StressTestCase target = new StressTestCase();
         target.PerformStressTest();
         TestCaseResult actual = target.GetStressTestResult();
         if (actual.Result == TestResult.Fail)
         {
             Assert.IsTrue(actual.ReasonForFailure.Length > 0);
         }
         else
         {
             Assert.IsTrue(actual.ReasonForFailure == null);
         }
     }
 }