2017-03-01 21:40:57 +01:00
|
|
|
|
// ***************************************************************************
|
|
|
|
|
//
|
|
|
|
|
// Delphi MVC Framework
|
|
|
|
|
//
|
|
|
|
|
// Copyright (c) 2010-2017 Daniele Teti and the DMVCFramework Team
|
|
|
|
|
//
|
|
|
|
|
// https://github.com/danieleteti/delphimvcframework
|
|
|
|
|
//
|
|
|
|
|
// Collaborators with this file: Ezequiel Juliano M<>ller (ezequieljuliano@gmail.com)
|
|
|
|
|
//
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
//
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
|
|
|
|
|
program TestSerializerJSON;
|
|
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
|
{$IFNDEF TESTINSIGHT}
|
2017-03-01 21:40:57 +01:00
|
|
|
|
{$APPTYPE CONSOLE}
|
2017-08-20 02:36:22 +02:00
|
|
|
|
{$ENDIF}{$STRONGLINKTYPES ON}
|
2017-03-01 21:40:57 +01:00
|
|
|
|
|
|
|
|
|
uses
|
2017-07-12 13:14:43 +02:00
|
|
|
|
System.SysUtils,
|
2017-08-20 02:36:22 +02:00
|
|
|
|
{$IFDEF TESTINSIGHT}
|
|
|
|
|
TestInsight.DUnitX,
|
|
|
|
|
{$ENDIF }
|
|
|
|
|
DUnitX.Loggers.Console,
|
|
|
|
|
DUnitX.Loggers.Xml.NUnit,
|
|
|
|
|
DUnitX.TestFramework,
|
2017-03-01 21:40:57 +01:00
|
|
|
|
MVCFramework.Tests.Serializer.JSON in 'MVCFramework.Tests.Serializer.JSON.pas',
|
|
|
|
|
MVCFramework.Tests.Serializer.Entities in '..\..\common\MVCFramework.Tests.Serializer.Entities.pas',
|
|
|
|
|
MVCFramework.Serializer.JSON in '..\..\..\sources\MVCFramework.Serializer.JSON.pas',
|
2017-03-02 13:27:19 +01:00
|
|
|
|
MVCFramework.Serializer.JSON.CustomTypes in '..\..\..\sources\MVCFramework.Serializer.JSON.CustomTypes.pas',
|
2017-03-29 14:49:35 +02:00
|
|
|
|
MVCFramework.Tests.Serializer.Intf in '..\..\common\MVCFramework.Tests.Serializer.Intf.pas',
|
|
|
|
|
MVCFramework.Tests.Serializer.EntitiesModule in '..\..\common\MVCFramework.Tests.Serializer.EntitiesModule.pas' {EntitiesModule: TDataModule};
|
2017-03-01 21:40:57 +01:00
|
|
|
|
|
|
|
|
|
{$R *.RES}
|
|
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
|
var
|
|
|
|
|
runner : ITestRunner;
|
|
|
|
|
results : IRunResults;
|
|
|
|
|
logger : ITestLogger;
|
|
|
|
|
nunitLogger : ITestLogger;
|
2017-03-01 21:40:57 +01:00
|
|
|
|
begin
|
2017-07-12 13:14:43 +02:00
|
|
|
|
FormatSettings.TimeSeparator := ':';
|
2017-08-20 02:36:22 +02:00
|
|
|
|
{$IFDEF TESTINSIGHT}
|
|
|
|
|
TestInsight.DUnitX.RunRegisteredTests;
|
|
|
|
|
exit;
|
2017-07-12 13:14:43 +02:00
|
|
|
|
{$ENDIF}
|
2017-03-01 21:40:57 +01:00
|
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
|
try
|
|
|
|
|
//Check command line options, will exit if invalid
|
|
|
|
|
TDUnitX.CheckCommandLine;
|
|
|
|
|
//Create the test runner
|
|
|
|
|
runner := TDUnitX.CreateRunner;
|
|
|
|
|
//Tell the runner to use RTTI to find Fixtures
|
|
|
|
|
runner.UseRTTI := True;
|
|
|
|
|
//tell the runner how we will log things
|
|
|
|
|
//Log to the console window
|
|
|
|
|
logger := TDUnitXConsoleLogger.Create(true);
|
|
|
|
|
runner.AddLogger(logger);
|
|
|
|
|
//Generate an NUnit compatible XML File
|
|
|
|
|
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
|
|
|
|
|
runner.AddLogger(nunitLogger);
|
|
|
|
|
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
|
|
|
|
|
|
|
|
|
|
//Run tests
|
|
|
|
|
results := runner.Execute;
|
|
|
|
|
if not results.AllPassed then
|
|
|
|
|
System.ExitCode := EXIT_ERRORS;
|
|
|
|
|
|
|
|
|
|
{$IFNDEF CI}
|
|
|
|
|
//We don't want this happening when running under CI.
|
|
|
|
|
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
|
|
|
|
|
begin
|
|
|
|
|
System.Write('Done.. press <Enter> key to quit.');
|
|
|
|
|
System.Readln;
|
|
|
|
|
end;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
except
|
|
|
|
|
on E: Exception do
|
|
|
|
|
System.Writeln(E.ClassName, ': ', E.Message);
|
|
|
|
|
end;
|
2017-03-01 21:40:57 +01:00
|
|
|
|
end.
|