Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasdepetrisd committed Mar 18, 2024
2 parents 6a50e6e + aeeefc0 commit cbeeeb4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Domain/Models/Ventas/LineaDeVenta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public LineaDeVenta(int cantidad, Inventario inventario, Venta venta)
Venta = venta;
}

public LineaDeVenta(int cantidad, Inventario inventario)
{
Cantidad = cantidad;
Inventario = inventario;
}

public decimal CalcularSubtotal()
{
if (Inventario.Articulo != null)
Expand Down
38 changes: 37 additions & 1 deletion test/UnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
using Domain.Models.Admin;
using Domain.Models.Articulo;
using Domain.Models.Ventas;

namespace UnitTests
{
public class UnitTest1
{
[Fact]
public void Test1()
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 cbeeeb4

Please sign in to comment.