databinding

T4.Filemanager .NET Report

Last execution time: 19/11/2024 08:56:09

Build: 4.0.2

State: Ok

100%

Indicators

24
Total
24
100.00% Ok
0
0.00% Error
0
0.00% Others
0
0.00% Manual
00:01:01
Duration

ClassMethod
FileAutomationStepsThen the following files exists:
ThenFollowingFilesExists (IList`1 files)
FileAutomationStepsThen the following files are not generated:
ThenFollowingFilesNotExists (IList`1 files)

Summary

Features

Features
Functionality Tests Ok Error Others Manual Duration
UT001 Generate Code
100%
10 10 0 0 0 00:00:38
UT002 Generate File in subfolder
100%
2 2 0 0 0 00:00:02
UT003 Generate File in other project
100%
1 1 0 0 0 00:00:01
UT004 Generate File with custom tool
100%
3 3 0 0 0 00:00:02
UT006 Generate File with standard header
100%
2 2 0 0 0 00:00:02
UT009 Generate File with cleanup old File
100%
1 1 0 0 0 00:00:01
UT013 Generate File with overwrite
100%
1 1 0 0 0 00:00:05
UT013 Generate File without modifications
100%
2 2 0 0 0 00:00:05
UT016 Log activities
100%
2 2 0 0 0 00:00:02
100%
24 24 0 0 0 00:01:01

Features > Features

Feature: UT001 Generate Code

As a developer I can generate code with the T4.FileManager with each class in its own file
Acceptance criterias 10/10 (100%)
Duration

Background
Given the file manager
00:00.056
Given the script "Test.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "PersonDto", "OrderDto" }; var fileManager = T4FileManager.Create(this).EnableLog(); foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs", "",""); #> namespace Test { public class <#= itm #> { } } <# } fileManager.Process(); #>
00:00.684
When I run the script
00:00.199
Then the following files are generated:
File
PersonDto.g.cs
OrderDto.g.cs
00:00.000

Background
Given the file manager
00:00.006
Given the script "TestMissingFileExtension.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "PersonTxtDto", "OrderTxtDto" }; var fileManager = T4FileManager.Create(this); foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs", "",""); #> namespace Test { public class <#= itm #> { } } <# } fileManager.Process(); #>
00:00.945
When I run the script
00:00.295
Then the following files are generated:
File
PersonTxtDto.g.cs
OrderTxtDto.g.cs
00:00.001

Background
Given the file manager
00:02.394

Background
Given the file manager
00:00.047

Background
Given the file manager
00:00.398
Given the script "TestAutoIndent.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "FileFormat" }; var fileManager = T4FileManager.Create(this).EnableAutoIndent(); // <=== Enable Format Document foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs", "",""); #> namespace Test { public partial class <#= itm #> { public int Id {get; set;} public string Name {get; set;} } } <# } fileManager.Process(); #>
00:10.825
When I run the script
00:00.692
Then the file "FileFormat.g.cs" has following format:
namespace Test { public partial class FileFormat { public int Id { get; set; } public string Name { get; set; } } }
00:00.219

Background
Given the file manager
00:00.017
Given the script "TestDefaultEncoding.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "FileDefaultEncoding" }; var fileManager = T4FileManager.Create(this); foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs", "",""); #> namespace Test { public partial class <#= itm #> { public int Id {get; set;} } } <# } fileManager.Process(); #>
00:00.716
When I run the script
00:00.361
Then the file "FileDefaultEncoding.g.cs" is encoded in "UTF-8"
00:00.004

Background
Given the file manager
00:08.506
Given the script "TestUTF16Encoding.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "TestUTF16Encoding" }; var fileManager = T4FileManager.Create(this).EnableLog().SetOutputFileEncoding(Encoding.Unicode); // <=== Set encoding for output file foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs", "",""); #> namespace Test { public partial class <#= itm #> { public int Id {get; set;} } } <# } fileManager.Process(); #>
00:00.684
When I run the script
00:00.316
Then the file "TestUTF16Encoding.g.cs" is encoded in "UTF-16"
00:00.001

Background
Given the file manager
00:00.208
Given the script "TestBigEndianEncoding.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "TesBigEndianEncoding" }; var fileManager = T4FileManager.Create(this).EnableLog().SetOutputFileEncoding(Encoding.BigEndianUnicode); foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.sql", "",""); #> SELECT 'öäüé' <#=itm#> <# } fileManager.Process(); #>
00:00.918
When I run the script
00:00.403
Then the file "TesBigEndianEncoding.g.sql" is encoded in "UTF-16BE"
00:00.001

Background
Given the file manager
00:00.080
Given a solution with setup project
00:00.224
And the script "ProjectItemsTest.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "ProjectItemsPersonDto" }; var fileManager = T4FileManager.Create(this).EnableLog(); foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs", "",""); #> namespace Test { public class <#= itm #> { } } <# } fileManager.Process(); #>
00:00.917
When I run the script
00:00.283
Then the following files are generated:
File
ProjectItemsPersonDto.g.cs
00:00.000
And the setup projects ProjectItems property is null
00:00.162

Background
Given the file manager
00:00.041
Given the script "TestSystemXml.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ assembly name="System.Xml" #> <#@ assembly name="System.Xml.Linq" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Xml" #> <#@ import namespace="System.Xml.Linq" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var fileManager = T4FileManager.Create(this).EnableAutoIndent(); #> <# fileManager.StartNewFile("text.g.xml", "",""); var doc = new XmlDocument(); doc.LoadXml("<book>Reading</book>"); #> <#=doc.InnerXml#> <# fileManager.Process(); #>
00:00.135
When I run the script
00:07.450
Then the following files are generated:
File
text.g.xml
00:00.000
Features > Features

Feature: UT002 Generate File in subfolder

As a developer I can generate code with the T4.FileManager with each class in its own file in a subfolder
Acceptance criterias 2/2 (100%)
Duration

Background
Given the file manager
00:00.027
Given the script "TestSubfolder.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "PersonDto", "OrderDto" }; var fileManager = new T4FileManager(this); foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs","","TestSubfolder"); #> namespace Test.TestSubFolder { public class <#= itm #> { } } <# } fileManager.Process(); #>
00:00.754
When I run the script
00:00.315
Then the following files are generated:
File Folder
PersonDto.g.cs TestSubfolder
OrderDto.g.cs TestSubfolder
00:00.000

Background
Given the file manager
00:00.005
Given the script "TestSubfolderMoving.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "PersonMDto", "OrderMDto" }; var fileManager = new T4FileManager(this); foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs","","TestSubfolder"); #> namespace Test.TestSubFolder { public class <#= itm #> { } } <# } fileManager.Process(); #>
00:00.705
When I run the script
00:00.225
And I change the line
From To
fileManager.StartNewFile(itm + ".g.cs","","TestSubfolder"); fileManager.StartNewFile(itm + ".g.cs","","TestSubfolderNew");
00:00.134
And I run the script again
00:00.660
Then the following files are generated:
File Folder
PersonMDto.g.cs TestSubfolderNew
OrderMDto.g.cs TestSubfolderNew
00:00.000
And the following files no longer exist:
File Folder
PersonMDto.g.cs TestSubfolder
OrderMDto.g.cs TestSubfolder
00:00.000
Features > Features

Feature: UT003 Generate File in other project

As a developer I can generate code with the T4.FileManager with each class in its own file or in different projects
Acceptance criterias 1/1 (100%)
Duration

Given the file manager
00:00.060
And the script "TestInOtherProject.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "PersonDto", "OrderDto" }; var fileManager = new T4FileManager(this); foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs","T4.FileManager.NetCore.AcceptanceCriteria.ExampleTestProject",""); #> namespace Test { public class <#= itm #> { } } <# } fileManager.Process(); #>
00:00.749
And I select the target project "T4.FileManager.NetCore.AcceptanceCriteria.ExampleTestProject"
00:00.000
When I run the script
00:00.217
Then the following files are generated:
File
PersonDto.g.cs
OrderDto.g.cs
00:00.000
Features > Features

Feature: UT004 Generate File with custom tool

As a developer I can generate code with the T4.FileManager and definied custom tool properties
Acceptance criterias 3/3 (100%)
Duration

Background
Given the file manager
00:00.086

Background
Given the file manager
00:00.006
Given the script "ProjectTestFP.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var document = new List<string[]>(); document.Add(new string[] { "FirstName", "Vorname", "Angaben zum Vornamen"}); document.Add(new string[] { "LastName", "Nachname", "Angaben zum Nachnamen"}); document.Add(new string[] { "Street", "Strasse", "Angaben zur Strasse"}); var fileManager = TemplateFileManager.Create(this); var fp = new FileProperties(); fp.CustomTool = "ResXFileCodeGenerator"; fileManager.StartNewFile("ProjectTestFP.resx", "", "", fp); #> <?xml version="1.0" encoding="utf-8"?> <root> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <# for (int idx = 0; idx < document.Count; idx++) { var item = document[idx]; #> <data name="<#= item[0] #>" xml:space="preserve"> <value><#= item[1] #></value> <comment><#= item[2] #></comment> </data> <#} #> </root> <# fileManager.Process(); #>
00:01.176
When I run the script
00:00.205
Then the following files are generated:
File
ProjectTestFP.resx
ProjectTestFP.Designer.cs
00:00.000
And the custom tool is set to "ResXFileCodeGenerator" for the following files:
File
ProjectTestFP.resx
00:00.284

Background
Given the file manager
00:00.006
Given the script "GenerateEmbeddedResource.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <#@ output extension=".txt" #> <# var outputContent = @"[""generated1"",""generated2""]"; var fileName = "data.json"; var project = "T4.FileManager.NetCore.AcceptanceCriteria.ExampleTestProject"; var projectPath = "Data"; var manager = T4FileManager.Create(this); manager.EnableLog(); var embeddedProperties = new FileProperties(){BuildAction = BuildAction.EmbeddedResource}; manager.CreateNewFile(fileName, project, projectPath, embeddedProperties); #> <#= outputContent #> <# manager.FinishFile(); manager.Process(); #>
00:00.815
Then the following files with BuildAction exists:
File Project BuildAction
data.json T4.FileManager.NetCore.AcceptanceCriteria.ExampleTestProject EmbeddedResource
data.json T4.FileManager.NetCore.AcceptanceCriteria None
00:00.139
Features > Features

Feature: UT006 Generate File with standard header

As a developer I can generate code with the T4.FileManager using a standard header
Acceptance criterias 2/2 (100%)
Duration

Background
Given the file manager
00:00.150
Given the script "TestGlobalHeader.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var fileManager = T4FileManager.Create(this); fileManager.StartHeader(); #> // ------------------------- // databinding - T4 // ------------------------- <# fileManager.FinishHeader(); fileManager.StartNewFile("PersonDtoWithGlobal.g.cs","",""); #> namespace Test { public class PersonDtoWithGlobal { } } <# fileManager.CreateNewFile("OrderDtoWithGlobal.g.cs","",""); #> namespace Test { public class OrderDtoWithGlobal { } } <# fileManager.Process(); #>
00:00.806
When I run the script
00:00.223
Then the file "PersonDtoWithGlobal.g.cs" starts with header:
// ------------------------- // databinding - T4 // -------------------------
00:00.001
And the file "PersonDtoWithGlobal.g.cs" starts with header:
// ------------------------- // databinding - T4 // -------------------------
00:00.000

Background
Given the file manager
00:00.005
Given the script "TestSA1633Header.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var fileManager = T4FileManager.Create(this); fileManager.StartHeader(); #> // <copyright file="$filename$" company="databinding.gmbh"> // databinding.gmbh - All rights reserved. // </copyright> // <author>Mr. T4</author> <# fileManager.FinishHeader(); fileManager.StartNewFile("PersonDtoWithSA1633.g.cs","",""); #> namespace Test { public class PersonDtoWithHeader { } } <# fileManager.StartNewFile("OrderDtoWithSA1633.g.cs","",""); #> namespace Test { public class OrderDtoWithHeader { } } <# fileManager.Process(); #>
00:00.764
When I run the script
00:00.286
Then the file "PersonDtoWithSA1633.g.cs" starts with header:
// <copyright file="PersonDtoWithSA1633.g.cs" company="databinding.gmbh"> // databinding.gmbh - All rights reserved. // </copyright> // <author>Mr. T4</author>
00:00.001
And the file "OrderDtoWithSA1633.g.cs" starts with header:
// <copyright file="OrderDtoWithSA1633.g.cs" company="databinding.gmbh"> // databinding.gmbh - All rights reserved. // </copyright> // <author>Mr. T4</author>
00:00.001
Features > Features

Feature: UT009 Generate File with cleanup old File

As a developer I can generate code with the T4.FileManager without taking care of old generated files
Acceptance criterias 1/1 (100%)
Duration

Background
Given the file manager
00:00.071
And the script "TestOldFilesCleanUp.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var fileManager = T4FileManager.Create(this); fileManager.StartNewFile("TestOldFilesCleanUp.g.cs","",""); #> namespace Test { public class TestOldFilesCleanUp { } } <# fileManager.Process(); #>
00:00.778
When I run the script
00:00.336
Then the following files are generated:
File
TestOldFilesCleanUp.g.cs
00:00.000
Given I change the line
From To
fileManager.StartNewFile("TestOldFilesCleanUp.g.cs","",""); fileManager.StartNewFile("TestOldFilesCleanUpRenamed.g.cs","","");
00:00.135
When I run the script
00:00.435
Then the following files are cleaned up:
File
TestOldFilesCleanUp.g.cs
00:00.000
And the following files are generated:
File
TestOldFilesCleanUpRenamed.g.cs
00:00.000
Features > Features

Feature: UT013 Generate File without modifications

As a developer I can generate code with the T4.FileManager and supress changes if the file exist
Acceptance criterias 2/2 (100%)
Duration

Given the file manager
00:00.025
And the script "TestNoDelete.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var fileManager = T4FileManager.Create(this).DisableOverwriteExistingFile(); fileManager.StartNewFile("TestNoDelete.g.cs","","TestOverwrite"); #> namespace Test { public class TestNoDelete { // first run template } } <# fileManager.Process(); #>
00:00.825
And I run the script
00:00.288
And the following files are generated:
File Folder
TestNoDelete.g.cs TestOverwrite
00:00.000
And I change the line
From To
fileManager.StartNewFile("TestNoDelete.g.cs","","TestOverwrite"); fileManager.StartNewFile("TestNoDelete2.g.cs","","TestOverwrite");
public class TestNoDelete public class TestNoDelete2
00:02.321
When I run the script
00:00.258
Then the following files are generated:
File Folder
TestNoDelete.g.cs TestOverwrite
TestNoDelete2.g.cs TestOverwrite
00:00.000

Given the file manager
00:00.038
And the script "TestNoChange.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var fileManager = T4FileManager.Create(this).DisableOverwriteExistingFile(); fileManager.StartNewFile("TestNoChange.g.cs","","TestOverwrite"); #> namespace Test { public class TestNoDelete { // first run template } } <# fileManager.Process(); #>
00:00.804
And I run the script
00:00.233
And the following files are generated:
File Folder
TestNoChange.g.cs TestOverwrite
00:00.000
And I change the line
From To
// first run template // second run template
00:00.192
When I run the script
00:00.297
Then the following files are generated:
File Contains Folder
TestNoChange.g.cs // first run template TestOverwrite
00:00.002
Features > Features

Feature: UT013 Generate File with overwrite

As a developer I can change the behaviour of supress changes to overwrite existing files
Acceptance criterias 1/1 (100%)
Duration

Background
Given the file manager
00:00.010
And the script "TestDelete.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var fileManager = T4FileManager.Create(this).DisableOverwriteExistingFile(); fileManager.StartNewFile("TestDelete.g.cs","","TestOverwrite"); #> namespace Test { public class TestDelete { // first run template } } <# fileManager.Process(); #>
00:00.763
Given I run the script
00:00.225
And the following files are generated:
File Folder
TestDelete.g.cs TestOverwrite
00:00.000
And I change the line
From To
T4FileManager.Create(this).DisableOverwriteExistingFile(); T4FileManager.Create(this);
fileManager.StartNewFile("TestDelete.g.cs","","TestOverwrite"); fileManager.StartNewFile("TestNoDelete3.g.cs","","TestOverwrite");
public class TestDelete public class NewTestDeleteModel
00:04.326
When I run the script
00:00.276
Then the following files are generated:
File Folder
TestNoDelete3.g.cs TestOverwrite
00:00.000
And the following files are cleaned up:
File Folder
TestDelete.g.cs TestOverwrite
00:00.000
Features > Features

Feature: UT016 Log activities

As a developer I can log to the main output file so that I can analyze the generation process
Acceptance criterias 2/2 (100%)
Duration

Background
Given the file manager
00:00.075
Given the script "TestWithLogEnabled.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "PersonDto", "OrderDto" }; var fileManager = new T4FileManager(this).EnableLog(); // <-- log output to main file TestWithLogEnabled.txt foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs", "", "TestSubfolder"); #> namespace Test { public class <#= itm #> { } } <# } fileManager.Process(); #>
00:00.624
When I run the script
00:00.354
Then the file "TestWithLogEnabled.txt" contains following log fragments
Textfragment
Log to main output file enabled
Begin CreateNewFile PersonDto.g.cs
Start DeleteExistingFiles
2 files generated
00:00.009

Background
Given the file manager
00:00.010
Given the script "TestWithCustomLog.tt" with the following content
<#@ template debug="false" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".txt" #> <#@ include file="$(TargetDir)\T4.FileManager.VisualStudio.ttinclude" #> <# var files = new string[] { "PersonDto", "OrderDto" }; var fileManager = new T4FileManager(this).EnableLog(); // <-- log output to main file TestWithLogEnabled.txt foreach(var itm in files) { fileManager.StartNewFile(itm + ".g.cs", "", "TestSubfolder"); #> namespace Test { public class <#= itm #> { <# fileManager.Log("My custom log info for {0}", itm); #> } } <# } fileManager.Process(); #>
00:00.685
When I run the script
00:00.258
Then the file "TestWithCustomLog.txt" contains following log fragments
Textfragment
My custom log info for OrderDto
My custom log info for PersonDto
00:00.012