Skip to content

Commit

Permalink
refactor: quito proyecto unittest y los agrego a specflowtests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasdepetrisd committed Mar 18, 2024
1 parent cbeeeb4 commit dbe6911
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 7 deletions.
7 changes: 0 additions & 7 deletions TiendaAPI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpecFlowTests", "test\SpecF
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{11DAA690-FA76-4B07-9309-2ECBEBA25B28}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "test\UnitTests\UnitTests.csproj", "{85EABFBF-F103-4256-AB44-E70FEE9038AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -45,10 +43,6 @@ Global
{05EC554B-7E61-41E0-B9E7-EE0AF212F223}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05EC554B-7E61-41E0-B9E7-EE0AF212F223}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05EC554B-7E61-41E0-B9E7-EE0AF212F223}.Release|Any CPU.Build.0 = Release|Any CPU
{85EABFBF-F103-4256-AB44-E70FEE9038AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85EABFBF-F103-4256-AB44-E70FEE9038AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85EABFBF-F103-4256-AB44-E70FEE9038AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85EABFBF-F103-4256-AB44-E70FEE9038AA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -59,7 +53,6 @@ Global
{7FDA7A40-F678-4B7B-850C-DD5A839B96E2} = {95D8FD13-5B3C-4BAA-8364-1CAD8B55037D}
{BC6B7D15-65C7-46D2-AF47-4F4CFC7BBA1E} = {95D8FD13-5B3C-4BAA-8364-1CAD8B55037D}
{05EC554B-7E61-41E0-B9E7-EE0AF212F223} = {11DAA690-FA76-4B07-9309-2ECBEBA25B28}
{85EABFBF-F103-4256-AB44-E70FEE9038AA} = {11DAA690-FA76-4B07-9309-2ECBEBA25B28}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {287B0F3C-BADB-4459-A55C-B8F96901402D}
Expand Down
47 changes: 47 additions & 0 deletions test/SpecFlowTests/UnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using Domain.Models.Admin;
using Domain.Models.Articulo;
using Domain.Models.Ventas;

namespace UnitTests
{
public class UnitTest1
{
[Fact]
public void TipoDeComprobanteFacturaBConEmisorRIYReceptorCF()
{
string nombreComprobante = "Factura B";

CondicionTributaria condicionTributariaEmisor = new CondicionTributaria { IdCondicionTributaria = IdCondicionTributaria.ResponsableInscripto };
CondicionTributaria condicionTributariaReceptor = new CondicionTributaria { IdCondicionTributaria = IdCondicionTributaria.ConsumidorFinal };

TipoDeComprobante tipoComp = new TipoDeComprobante(condicionTributariaEmisor, condicionTributariaReceptor);

Assert.Equal(nombreComprobante, tipoComp.Nombre);
}

[Fact]
public void CalcularSubtotalMedianteLineaDeVenta()
{
int cantidadComprar = 1;

Articulo articulo = new Articulo
{
Costo = 120_000,
PorcentajeIVA = 21,
MargenGanancia = 50
};

Inventario inventario = new Inventario
{
Articulo = articulo,
Cantidad = 10,
};

LineaDeVenta ldv = new LineaDeVenta(cantidadComprar, inventario);

decimal subtotal = ldv.CalcularSubtotal();

Assert.Equal(217_800, subtotal);
}
}
}

0 comments on commit dbe6911

Please sign in to comment.