コード例 #1
0
        } //End method GetConfiguration


        /// <summary> This method returns the Measure object that matches the one passed into the function. </summary>
        /// <param name="measure"> A Container Measure object. </param>
        /// <returns> The matched object if found, otherwise adds it to the DB and return the object. </returns>
        public void GetMeasure(Cont.Measure measure)
        {
            var info = Measures.FirstOrDefault(x => x.Equals(measure));
            if (info == null)
            {
                measure.ID = Handler.Measure.Add(measure);
                Measures.Add(measure);
            }
            else
            {
                measure.ID = info.ID;
            }
        } //End method
コード例 #2
0
        public void AddObject()
        {
            System.Diagnostics.Debug.WriteLine("Unit test for object has started...");

            BizContainer.Measure measure = new BizContainer.Measure()
            {
                Name = "MeasureTest2"
            };

            try
            {
                int ID = BizHandler.Measure.Add(measure);
                measure.ID = ID;
                System.Diagnostics.Debug.WriteLine(String.Format("Measure ID: {0} Name: {1}", measure.ID, measure.Name));
            } catch (Exception exc)
            {
                System.Diagnostics.Debug.WriteLine(String.Format("ERROR: {0} \n {1}", exc.Message, exc.InnerException));
                throw exc;
            }

            System.Diagnostics.Debug.WriteLine("Unit test for object has ended...");
        }