Skip to content

Commit

Permalink
test project re-organized
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanstapel committed Nov 9, 2020
1 parent 1796f14 commit cb6fcda
Show file tree
Hide file tree
Showing 17 changed files with 490 additions and 1,012 deletions.
460 changes: 0 additions & 460 deletions ZUGFeRD-Test/Application.cs

This file was deleted.

47 changes: 0 additions & 47 deletions ZUGFeRD-Test/Assert.cs

This file was deleted.

42 changes: 42 additions & 0 deletions ZUGFeRD-Test/BasicTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using s2industries.ZUGFeRD;
using System;
using System.Collections.Generic;
using System.Text;

namespace ZUGFeRD_Test
{
[TestClass]
public class BasicTests
{
InvoiceProvider InvoiceProvider = new InvoiceProvider();


[TestMethod]
public void TestAutomaticLineIds()
{
InvoiceDescriptor desc = this.InvoiceProvider.CreateInvoice();
desc.TradeLineItems.Clear();

desc.AddTradeLineItem("Item1");
desc.AddTradeLineItem("Item2");

Assert.AreEqual(desc.TradeLineItems[0].AssociatedDocument.LineID, "1");
Assert.AreEqual(desc.TradeLineItems[1].AssociatedDocument.LineID, "2");
} // !TestAutomaticLineIds()



[TestMethod]
void TestManualLineIds()
{
InvoiceDescriptor desc = this.InvoiceProvider.CreateInvoice();
desc.TradeLineItems.Clear();
desc.AddTradeLineItem(lineID: "item-01", "Item1");
desc.AddTradeLineItem(lineID: "item-02", "Item2");

Assert.AreEqual(desc.TradeLineItems[0].AssociatedDocument.LineID, "item-01");
Assert.AreEqual(desc.TradeLineItems[1].AssociatedDocument.LineID, "item-02");
} // !TestManualLineIds()
}
}
99 changes: 99 additions & 0 deletions ZUGFeRD-Test/InvoiceProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
using s2industries.ZUGFeRD;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZUGFeRD_Test
{
internal class InvoiceProvider
{
internal InvoiceDescriptor CreateInvoice()
{
InvoiceDescriptor desc = InvoiceDescriptor.CreateInvoice("471102", new DateTime(2018, 03, 05), CurrencyCodes.EUR);
desc.AddNote("Rechnung gemäß Bestellung vom 01.03.2018.");
desc.AddNote(note: "Lieferant GmbH\r\nLieferantenstraße 20\r\n80333 München\r\nDeutschland\r\nGeschäftsführer: Hans Muster\r\nHandelsregisternummer: H A 123\r\n",
subjectCode: SubjectCodes.REG
);

desc.AddTradeLineItem(name: "Trennblätter A4",
unitCode: QuantityCodes.H87,
sellerAssignedID: "TB100A4",
id: new GlobalID("0160", "4012345001235"),
grossUnitPrice: 9.9m,
netUnitPrice: 9.9m,
billedQuantity: 20m,
taxType: TaxTypes.VAT,
categoryCode: TaxCategoryCodes.S,
taxPercent: 19m
);

desc.AddTradeLineItem(name: "Joghurt Banane",
unitCode: QuantityCodes.H87,
sellerAssignedID: "ARNR2",
id: new GlobalID("0160", "4000050986428"),
grossUnitPrice: 5.5m,
netUnitPrice: 5.5m,
billedQuantity: 50,
taxType: TaxTypes.VAT,
categoryCode: TaxCategoryCodes.S,
taxPercent: 7
);

desc.ReferenceOrderNo = "04011000-12345-34";
desc.SetSeller(name: "Lieferant GmbH",
postcode: "80333",
city: "München",
street: "Lieferantenstraße 20",
country: CountryCodes.DE,
id: "",
globalID: new GlobalID("0088", "4000001123452")
);
desc.SetSellerContact(name: "Max Mustermann",
orgunit: "Muster-Einkauf",
emailAddress: "[email protected]",
phoneno: "+49891234567"
);
desc.AddSellerTaxRegistration("201/113/40209", TaxRegistrationSchemeID.FC);
desc.AddSellerTaxRegistration("DE123456789", TaxRegistrationSchemeID.VA);

desc.SetBuyer(name: "Kunden AG Mitte",
postcode: "69876",
city: "Frankfurt",
street: "Kundenstraße 15",
country: CountryCodes.DE,
id: "GE2020211"
);

desc.ActualDeliveryDate = new DateTime(2018, 03, 05);
desc.SetPaymentMeans(PaymentMeansTypeCodes.SEPACreditTransfer, "Zahlung per SEPA Überweisung.");
desc.AddCreditorFinancialAccount(iban: "DE02120300000000202051", bic: "BYLADEM1001", name: "Kunden AG");

desc.AddApplicableTradeTax(basisAmount: 275.0m,
percent: 7m,
typeCode: TaxTypes.VAT,
categoryCode: TaxCategoryCodes.S
);

desc.AddApplicableTradeTax(basisAmount: 198.0m,
percent: 19m,
typeCode: TaxTypes.VAT,
categoryCode: TaxCategoryCodes.S
);

desc.SetTradePaymentTerms("Zahlbar innerhalb 30 Tagen netto bis 04.04.2018, 3% Skonto innerhalb 10 Tagen bis 15.03.2018");
desc.SetTotals(lineTotalAmount: 473.0m,
chargeTotalAmount: 0.0m,
allowanceTotalAmount: 0.0m,
taxBasisAmount: 473.0m,
taxTotalAmount: 56.87m,
grandTotalAmount: 529.87m,
totalPrepaidAmount: 0.0m,
duePayableAmount: 529.87m
);

return desc;
} // !CreateInvoice()
}
}
34 changes: 0 additions & 34 deletions ZUGFeRD-Test/Program.cs

This file was deleted.

38 changes: 2 additions & 36 deletions ZUGFeRD-Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ZUGFeRD-Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZUGFeRD-Test")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("25ab730b-71ae-49ab-b727-5ee63e6f49ff")]
[assembly: Guid("83a81f31-508c-4e35-bbac-fb095704d9b6")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
73 changes: 38 additions & 35 deletions ZUGFeRD-Test/ZUGFeRD-Test.csproj
Original file line number Diff line number Diff line change
@@ -1,77 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1FF5A300-0D7A-4C87-9785-D9C5483DB301}</ProjectGuid>
<OutputType>Exe</OutputType>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{83A81F31-508C-4E35-BBAC-FB095704D9B6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ZUGFeRD_Test</RootNamespace>
<AssemblyName>ZUGFeRD-Test</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Application.cs" />
<Compile Include="Assert.cs" />
<Compile Include="Program.cs" />
<Compile Include="BasicTests.cs" />
<Compile Include="InvoiceProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ZugFerd1BasicGenerator.cs" />
<Compile Include="ZugFerd1ComfortEinfachGenerator.cs" />
<Compile Include="ZugFerd1ExtendedWarenrechnungGenerator.cs" />
<Compile Include="ZUGFeRD10Tests.cs" />
<Compile Include="ZUGFeRD20Tests.cs" />
<Compile Include="ZUGFeRD21Tests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ZUGFeRD\ZUGFeRD.csproj">
<Project>{b9550547-0a5c-445d-88c7-dd481881e62f}</Project>
<Name>ZUGFeRD</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Import Project="packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
</Project>
Loading

0 comments on commit cb6fcda

Please sign in to comment.