47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
|
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
|
|
using LCU.API.Internal.CoreSoapApiWrapper.Services;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Moq;
|
|
using System;
|
|
|
|
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Services
|
|
{
|
|
[TestClass]
|
|
public class TaxServicesTest
|
|
{
|
|
private readonly TaxService _service;
|
|
private readonly Mock<ITaxDao> _mockTaxDao;
|
|
|
|
public TaxServicesTest()
|
|
{
|
|
_mockTaxDao = new Mock<ITaxDao>();
|
|
_service = new TaxService(_mockTaxDao.Object);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void GetTaxIdData_OK()
|
|
{
|
|
var taxIdResponse = new GetTaxIdDataResponse
|
|
{
|
|
WasSuccessful = true
|
|
};
|
|
|
|
_mockTaxDao.Setup(x => x.GetTaxIdData(1001)).Returns(taxIdResponse).Verifiable();
|
|
|
|
var result = _service.GetTaxIdData(1001);
|
|
Assert.IsNotNull(result);
|
|
Assert.IsTrue((bool)result.WasSuccessful);
|
|
_mockTaxDao.Verify();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void GetTaxIdData_Exception()
|
|
{
|
|
_mockTaxDao.Setup(x => x.GetTaxIdData(1001)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
|
|
|
|
Assert.ThrowsException<Exception>(() => _service.GetTaxIdData(1001));
|
|
_mockTaxDao.Verify();
|
|
}
|
|
}
|
|
} |