public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            PerformanceParameterTypeGroup s = obj as PerformanceParameterTypeGroup;

            if ((System.Object)s == null)
            {
                return(false);
            }

            if (this.id != s.id)
            {
                return(false);
            }
            if (this.name != s.name)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        public void PerformanceParameterTypeGroup_Initialization_Test()
        {
            try
            {
                // Arrange and Act
                PerformanceParameterTypeGroup performanceParameterTypeGroup = new PerformanceParameterTypeGroup();

                // Assert
                Assert.IsNotNull(performanceParameterTypeGroup);
            }
            catch (Exception)
            {
                throw new AssertFailedException("PerformanceParameterTypeGroup initialization failed.");
            }
        }
        public ArrayList GetPerformanceParameterTypeGroups(long performanceParameterNameId)
        {
            String          sqlStr    = "SELECT group_id, GROUP_CONCAT(name separator ', ') FROM perf_para_type WHERE group_id IN (SELECT group_id FROM perf_para_link WHERE name_id = " + performanceParameterNameId + ") GROUP BY group_id";
            MySqlCommand    cmd       = new MySqlCommand(sqlStr, conn);
            MySqlDataReader sqlReader = cmd.ExecuteReader();
            ArrayList       performanceParameterTypeGroups = new ArrayList();
            PerformanceParameterTypeGroup pp = null;

            while (sqlReader.Read())
            {
                pp      = new PerformanceParameterTypeGroup();
                pp.id   = sqlReader.GetInt32(0);
                pp.name = sqlReader.GetString(1);
                performanceParameterTypeGroups.Add(pp);
            }

            sqlReader.Close();
            return(performanceParameterTypeGroups);
        }
Esempio n. 4
0
        public void PerformanceParameterTypeGroup_Property_Set_Test()
        {
            try
            {
                // Arrange
                PerformanceParameterTypeGroup performanceParameterTypeGroup = new PerformanceParameterTypeGroup();

                // Act
                performanceParameterTypeGroup.id   = 1;
                performanceParameterTypeGroup.name = "parameterTypeGroup";

                // Assert
                Assert.AreEqual <long>(performanceParameterTypeGroup.id, 1);
                Assert.AreEqual <string>(performanceParameterTypeGroup.name, "parameterTypeGroup");
            }
            catch (Exception)
            {
                throw new AssertFailedException("Setting PerformanceParameterTypeGroup properties failed.");
            }
        }
Esempio n. 5
0
        public void Get_All_PerformanceParameterTypeGroups_Test()
        {
            // Arrange
            ArrayList performanceParameterTypeGroupsObjsAsOuptut = new ArrayList();

            PerformanceParameterTypeGroup performanceParameterTypeGroupObj1AsOutput = new PerformanceParameterTypeGroup();

            performanceParameterTypeGroupObj1AsOutput.id   = 1;
            performanceParameterTypeGroupObj1AsOutput.name = "Para TypeGroup 1";

            PerformanceParameterTypeGroup performanceParameterTypeGroupObj2AsOutput = new PerformanceParameterTypeGroup();

            performanceParameterTypeGroupObj2AsOutput.id   = 2;
            performanceParameterTypeGroupObj2AsOutput.name = "Para TypeGroup 2";

            performanceParameterTypeGroupsObjsAsOuptut.Add(performanceParameterTypeGroupObj1AsOutput);
            performanceParameterTypeGroupsObjsAsOuptut.Add(performanceParameterTypeGroupObj2AsOutput);

            var mockRepository = new Mock <IPerformanceParameterTypeGroupRepository>();

            mockRepository.Setup(x => x.GetPerformanceParameterTypeGroups(1))
            .Returns(performanceParameterTypeGroupsObjsAsOuptut);

            var controller = new PerformanceParameterTypeGroupController(mockRepository.Object);

            controller.Request       = new HttpRequestMessage();
            controller.Configuration = new HttpConfiguration();

            // Act
            ArrayList performanceParameterTypeGroupsObj = controller.Get(1);

            // Assert
            Assert.AreEqual <int>(performanceParameterTypeGroupsObj.Count, performanceParameterTypeGroupsObjsAsOuptut.Count);
            Assert.AreEqual(performanceParameterTypeGroupsObj[0], performanceParameterTypeGroupsObjsAsOuptut[0]);
            Assert.AreEqual(performanceParameterTypeGroupsObj[1], performanceParameterTypeGroupsObjsAsOuptut[1]);
        }