예제 #1
0
        public void TestUpdateAward()
        {
            // Arrange
            Award newAward = new Award
            {
                AwardID          = 2,
                AwardName        = "Test Award",
                AwardDescription = "Test Description",
                GoalID           = 2,
                GoalTypeID       = 2
            };
            Award oldAward = new Award
            {
                AwardID          = 2,
                AwardName        = "Rewritten Test Award",
                AwardDescription = "Test Description",
                GoalID           = 2,
                GoalTypeID       = 2
            };

            // Act
            int changed = awardAccessor.UpdateAward(newAward, oldAward);

            // Assert
            Assert.IsTrue(changed == 0);
        }
예제 #2
0
        /// <summary>
        /// Nathaniel Webber
        /// Created: 2021/03/10
        ///
        /// This method grabs the corresponding stored procedure from the sql
        /// and uses it to update an award in the database
        /// </summary>
        public int UpdateAward(Award newAward, Award oldAward)
        {
            int rowsAffected;

            try
            {
                rowsAffected = _awardAccessor.UpdateAward(newAward, oldAward);
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Award could not be edited" + ex.InnerException);
            }

            return(rowsAffected);
        }