示例#1
0
        public void WorkUnitFrameData_CopyConstructor_OtherIsNull_Test()
        {
            // Act
            var copy = new WorkUnitFrameData(null);

            // Assert
            Assert.AreEqual(0, copy.ID);
            Assert.AreEqual(0, copy.RawFramesComplete);
            Assert.AreEqual(0, copy.RawFramesTotal);
            Assert.AreEqual(default(TimeSpan), copy.TimeStamp);
            Assert.AreEqual(default(TimeSpan), copy.Duration);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkUnitFrameData"/> class.
        /// </summary>
        /// <param name="other">The other instance from which data will be copied.</param>
        public WorkUnitFrameData(WorkUnitFrameData other)
        {
            if (other == null)
            {
                return;
            }

            ID = other.ID;
            RawFramesComplete = other.RawFramesComplete;
            RawFramesTotal    = other.RawFramesTotal;
            TimeStamp         = other.TimeStamp;
            Duration          = other.Duration;
        }
示例#3
0
        private static Dictionary <int, WorkUnitFrameData> CopyFrameData(IDictionary <int, WorkUnitFrameData> source)
        {
            if (source == null)
            {
                return(null);
            }

            var copy = new Dictionary <int, WorkUnitFrameData>();

            foreach (var kvp in source)
            {
                var valueCopy = new WorkUnitFrameData(kvp.Value);
                copy.Add(kvp.Key, valueCopy);
            }
            return(copy);
        }
示例#4
0
        public void WorkUnitFrameData_CopyConstructor_Test()
        {
            // Arrange
            var data = new WorkUnitFrameData
            {
                ID = 1,
                RawFramesComplete = 10000,
                RawFramesTotal    = 1000000,
                TimeStamp         = TimeSpan.FromMinutes(1),
                Duration          = TimeSpan.FromMinutes(2)
            };
            // Act
            var copy = new WorkUnitFrameData(data);

            // Assert
            Assert.AreEqual(data.ID, copy.ID);
            Assert.AreEqual(data.RawFramesComplete, copy.RawFramesComplete);
            Assert.AreEqual(data.RawFramesTotal, copy.RawFramesTotal);
            Assert.AreEqual(data.TimeStamp, copy.TimeStamp);
            Assert.AreEqual(data.Duration, copy.Duration);
        }