Click here to Skip to main content
15,894,405 members
Articles / Programming Languages / C# 4.0

Process Performance Determination in C#: Part 2

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
14 Jun 2012CPOL3 min read 17.1K   162   8  
The program presented here provides a simple way to obtain process performance through PPM.
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ProcessPerformance2;

namespace UnitTestPerformance2
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class UnitTestPerformance2
    {
        public UnitTestPerformance2()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void TestProcessPerformance2()
        {
            ProcessPerformanceFrPPM ppm = new ProcessPerformanceFrPPM();
            ppm.NumOfUnitProcessed = 40000;
            ppm.NumOfDefectivePart = 165;
            ppm.Analyze();
            Assert.AreEqual(0.004125, ppm.Result.DPU, 1E-06, "DPU failed!");
            Assert.AreEqual(4125, ppm.Result.PPM, 1E-02, "PPM failed!");
            Assert.AreEqual(99.5875, ppm.Result.YieldInPercent, 1E-04, "Yield failed!");
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Foundasoft.com
Malaysia Malaysia
Consultant

Comments and Discussions