-Поиск по дневнику

Поиск сообщений в rss_thedaily_wtf

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 06.04.2008
Записей:
Комментариев:
Написано: 0


CodeSOD: Excellent Test

Понедельник, 17 Октября 2016 г. 13:30 + в цитатник

These days, you arent just doing development. Your development has to be driven. Business driven. Domain driven. Test driven.

TDD is generally held up as a tool for improving developer efficiency and code quality. As it turns out, scholarly research doesnt support that: theres no indication that TDD has any impact at all.

I have to wonder, though, if maybe thats because people are still writing tests like this one, which Tomas received from an offshore contractor.

    public void CompareValues(string con, int pf, int pt, string tableVal, int len, string Ledpos1)
    {
        string databasevalue1 = (con.Substring(pf-1,len)).Trim();
        string tableval = tableVal.Trim();
        switch (pf)
        {
            case 61:
                Assert.AreEqual(databasevalue1, "00000" + Ledpos1, " Values are not equal ");
                Console.WriteLine("Excellent!");
                break;
            case 76:
                Console.WriteLine("Not check as it is random values");
                break;
            case 164:
                Console.WriteLine("TIME!");
                break;
            case 160:
                string todayDate = DateTime.Now.ToString("yyyyMMdd");
                Assert.AreEqual(todayDate, databasevalue1, "Both dates are not equal");
                break;
            case 270:
                string tOnedate = DateTime.Now.AddDays(1).ToString("yyyyMMdd");
                Assert.AreEqual(tOnedate, databasevalue1, "Both dates are not equal");
                break;
            default:
                Console.WriteLine(pf + pt + len + tableval + databasevalue1);
               Assert.AreEqual(tableval, databasevalue1, "Both values are not equal");
                break;
        }

        Console.WriteLine(pf + pt + len + tableval + databasevalue1);
    }

Excellent, indeed.

[Advertisement] Application Release Automation for DevOps – integrating with best of breed development tools. Free for teams with up to 5 users. Download and learn more today!

http://thedailywtf.com/articles/excellent-test

Метки:  

 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку