function WorldTestSuite:TestCaseAddChairToWorld() local result, errorInfo = World:AddEntity( "Chair" ) ASSERT( result, true, "Nie udalo sie postawic krzesla na swiecie.", errorInfo ) -- errorInfo jako 4 parametr to takie info techniczne - powod dla ktorego nie udalo sie tego zrobic end function World:AddEntity( name ) -- rejestrujemy polaczenie z baza danych - bedziemy ja pytac czy liczba elementow na swiecie sie zwiekszyla czy nie local createDatabaseConnectionResult, createDatabaseConnectionErrorInfo = CreateDatabaseConnection() if ( createDatabaseConnectionResult == false OR createDatabaseConnectionErrorInfo ~= nil ) then return false, createErrocreateDatabaseConnectionErrorInforInfo end -- ta metoda jets w chuj fake, chcialem poprostu aby wygladalo jakby mialo sens local currentEntitiesCount, currentEntitiesCountErrorInfo = GetIntFromDatabase( "entitiesCount" ) if ( currentEntitiesCountErrorInfo ~= nil ) then return false, currentEntitiesCountErrorInfo end local createResult, createErrorMessage = ask_engine_to_do_something( "createEntity(" .. name .. ")" ) if ( createResult == false OR createErrorMessage ~= nil ) then return false, createErrorMessage end -- sprawdzamy ponownie po utworzeniu krzesla liczbe entitek local entitiesCountAfter, entitiesCountAfterErrorInfo = GetIntFromDatabase( "entitiesCount" ) if ( entitiesCountAfterErrorInfo ~= nil ) then return false, entitiesCountAfterErrorInfo end if ( currentEntitiesCount >= entitiesCountAfter ) then return false, "Liczba entitek po dodaniu nowej jest rowna " .. entitiesCountAfter .. " i nie jest wieksza od poczatkowej liczby " .. currentEntitiesCount end local closeDatabaseConnectionResult, closeDatabaseConnectionErrorInfo = CloseDatabaseConnection() if ( closeDatabaseConnectionResult == false OR closeDatabaseConnectionErrorInfo ~= nil ) then return false, closeDatabaseConnectionErrorInfo end end