コード例 #1
0
        public void ExceptionTest()
        {
            Actress obj = null;
            string  stringifiedProperties = obj.StringifyProperties();

            Assert.IsTrue(stringifiedProperties.Contains("Failed to stringify properties"));
        }
コード例 #2
0
        public void PerformanceTest()
        {
            const int    ITERATIONS = 1000;
            const double MAX_ALLOWED_TIME_IN_MILLISECONDS = 100;

            var actress = new Actress
            {
                Name      = "Fernanda Montenegro",
                Age       = 90,
                BirthDate = new DateTime(1929, 10, 16)
            };

            var stw = Stopwatch.StartNew();

            for (int i = 0; i < ITERATIONS; i++)
            {
                actress.StringifyProperties();
            }
            stw.Stop();
            Assert.That(stw.ElapsedMilliseconds, Is.LessThan(MAX_ALLOWED_TIME_IN_MILLISECONDS));
        }
コード例 #3
0
        public void StringifyMethodTest()
        {
            string stringifiedProperties = _actress.StringifyProperties();

            Assert.AreEqual(EXCEPTED_STRINGIFIED_TEXT, stringifiedProperties);
        }