mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 08:15:53 +01:00
96 lines
3.3 KiB
ObjectPascal
96 lines
3.3 KiB
ObjectPascal
// ***************************************************************************
|
|
//
|
|
// 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 TestSerializerJsonDataObjects;
|
|
|
|
{$IFNDEF TESTINSIGHT}
|
|
{$APPTYPE CONSOLE}
|
|
{$ENDIF}{$STRONGLINKTYPES ON}
|
|
|
|
uses
|
|
System.SysUtils,
|
|
{$IFDEF TESTINSIGHT}
|
|
TestInsight.DUnitX,
|
|
{$ENDIF }
|
|
DUnitX.Loggers.Console,
|
|
DUnitX.Loggers.Xml.NUnit,
|
|
DUnitX.TestFramework,
|
|
MVCFramework.Tests.Serializer.JsonDataObjects in 'MVCFramework.Tests.Serializer.JsonDataObjects.pas',
|
|
MVCFramework.Serializer.JsonDataObjects in '..\..\..\sources\MVCFramework.Serializer.JsonDataObjects.pas',
|
|
MVCFramework.Tests.Serializer.Entities in '..\..\common\MVCFramework.Tests.Serializer.Entities.pas',
|
|
MVCFramework.Serializer.JsonDataObjects.CustomTypes in '..\..\..\sources\MVCFramework.Serializer.JsonDataObjects.CustomTypes.pas',
|
|
MVCFramework.Tests.Serializer.Intf in '..\..\common\MVCFramework.Tests.Serializer.Intf.pas',
|
|
MVCFramework.Tests.Serializer.EntitiesModule in '..\..\common\MVCFramework.Tests.Serializer.EntitiesModule.pas' {EntitiesModule: TDataModule};
|
|
|
|
{$R *.RES}
|
|
|
|
var
|
|
runner : ITestRunner;
|
|
results : IRunResults;
|
|
logger : ITestLogger;
|
|
nunitLogger : ITestLogger;
|
|
begin
|
|
FormatSettings.TimeSeparator := ':';
|
|
{$IFDEF TESTINSIGHT}
|
|
TestInsight.DUnitX.RunRegisteredTests;
|
|
exit;
|
|
{$ENDIF}
|
|
|
|
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;
|
|
end.
|