public void TestInActiveAndActiveCompaniesAndAccounts() { var companiesToCheck = new Dictionary<string, InputCompany>(CompanyGenerator.GetCorrectCompanies()); string inActiveCompanyNIP = CompanyGenerator.GetZakonczoneUpadaloscioweNIP(); string inActiveCompanyID = "u1"; //add inactive company InputCompany inactiveCompany = new InputCompany() { NIP = inActiveCompanyNIP, LP = inActiveCompanyID, RowNumber = 1 }; companiesToCheck.Add(inActiveCompanyID, inactiveCompany); Dictionary<string, WhiteListVerResult> verResults = _verifier.VerifyCompanies(companiesToCheck.Values.ToList<InputCompany>(), true, false); var companyInacticeResultCheck = verResults.FirstOrDefault(vr => vr.Key == inactiveCompany.ID); Assert.IsNotNull(companyInacticeResultCheck); Assert.AreEqual(WhiteListVerResultStatus.NotActiveVATPayer, companyInacticeResultCheck.Value.VerificationStatus); Assert.IsTrue(DTHelper.IsItToday(companyInacticeResultCheck.Value.VerificationDate)); Assert.AreEqual(inActiveCompanyNIP, companyInacticeResultCheck.Value.Nip); foreach (var companyToCheck in companiesToCheck.Where(c => c.Key != inActiveCompanyID)) { var companyChecked = verResults.FirstOrDefault(vr => vr.Key == companyToCheck.Key); Assert.IsNotNull(companyChecked); Assert.AreEqual(WhiteListVerResultStatus.ActiveVATPayerAccountOKVerSuccessfull, companyChecked.Value.VerificationStatus); Assert.IsTrue(companyChecked.Value.IsActiveVATPayer); Assert.AreEqual(companyToCheck.Value.NIP, companyChecked.Value.Nip); Assert.IsNotNull(companyChecked.Value.AccountNumbers); Assert.IsTrue(DTHelper.IsItToday(companyChecked.Value.VerificationDate)); Assert.IsTrue(companyChecked.Value.IsGivenAccountNumOnWhiteList); } }
/// <summary> /// Generates a random value of the specified type /// </summary> /// <param name="Rand">Random number generator that it can use</param> /// <returns>A randomly generated object of the specified type</returns> public string Next(System.Random Rand) { var CompanyName = new CompanyGenerator().Next(Rand); return(((CompanyName.Length > 10) ? CleanName(CompanyName.Split(' ')[0]) : CleanName(CompanyName)) + (CommonEndings ? Rand.Next(MostCommonEndings) : Rand.Next(Endings))); }
public void CorrectNipsPrawnaMulitiple() { Dictionary <string, InputCompany> correctCompanies = CompanyGenerator.GetCorrectCompanies(); var correctC = correctCompanies.Values.ToList(); for (int i = 0; i < correctC.Count(); i++) { var c = correctC[i]; InputCompany tempCompany = new InputCompany() { RowNumber = c.RowNumber + 20, NIP = c.NIP, LP = c.LP }; correctCompanies.Add(tempCompany.ID, tempCompany); tempCompany = new InputCompany() { RowNumber = c.RowNumber + 120, NIP = c.NIP, LP = c.LP }; correctCompanies.Add(tempCompany.ID, tempCompany); } Dictionary <string, BiRVerifyResult> verResults = _verifier.AreCompaniesActive(correctCompanies.Values.ToList <InputCompany>()); Assert.AreEqual(correctCompanies.Count, verResults.Count); Assert.AreEqual(0, correctCompanies.Keys.Except(verResults.Keys).Count()); foreach (var result in verResults) { Assert.AreEqual(BiRVerifyStatus.IsActive, result.Value.BiRVerifyStatus); } }
public void TestCorrectCompaniesWithInCorrectBankAccounts() { var companiesToCheck = new Dictionary<string, InputCompany>(CompanyGenerator.GetCorrectCompanies()); //0 - z³y account number, nie na liœcie InputCompany tempComp = companiesToCheck.ElementAt(0).Value; companiesToCheck.Remove(companiesToCheck.ElementAt(0).Key); companiesToCheck.Add(tempComp.ID, new InputCompany() { LP = tempComp.LP, BankAccountNumber = new string(tempComp.BankAccountNumber), NIP = tempComp.NIP, RowNumber= tempComp.RowNumber}); string notOnWhiteListAccountNumberID = tempComp.ID; //1- z literk¹ account number tempComp = companiesToCheck.ElementAt(1).Value; companiesToCheck.Remove(companiesToCheck.ElementAt(1).Key); companiesToCheck.Add(tempComp.ID, new InputCompany() { LP = tempComp.LP, BankAccountNumber = new string(tempComp.BankAccountNumber).Remove(5, 2).Insert(4, "ab"), NIP = new string(tempComp.NIP), RowNumber = tempComp.RowNumber }); companiesToCheck[notOnWhiteListAccountNumberID].BankAccountNumber = tempComp.BankAccountNumber; //2 - pusty account number tempComp = companiesToCheck.ElementAt(2).Value; companiesToCheck.Remove(companiesToCheck.ElementAt(2).Key); companiesToCheck.Add(tempComp.ID, new InputCompany() { LP = tempComp.LP, BankAccountNumber = string.Empty, NIP = new string(tempComp.NIP), RowNumber = tempComp.RowNumber }); //3 - null account number tempComp = companiesToCheck.ElementAt(3).Value; companiesToCheck.Remove(companiesToCheck.ElementAt(3).Key); companiesToCheck.Add(tempComp.ID, new InputCompany() { LP = tempComp.LP, BankAccountNumber = null, NIP = new string(tempComp.NIP), RowNumber = tempComp.RowNumber }); Dictionary<string, WhiteListVerResult> verResults = _verifier.VerifyCompanies(companiesToCheck.Values.ToList<InputCompany>(), true, false); KeyValuePair<string, WhiteListVerResult> companyChecked = verResults.FirstOrDefault(vr => vr.Key == companiesToCheck.ElementAt(0).Key); Assert.IsNotNull(companyChecked); Assert.AreEqual(WhiteListVerResultStatus.ActiveVATPayerButGivenAccountNotOnWhiteList, companyChecked.Value.VerificationStatus); Assert.IsTrue(companyChecked.Value.IsActiveVATPayer); Assert.AreEqual(companiesToCheck.ElementAt(0).Value.NIP, companyChecked.Value.Nip); Assert.IsNotNull(companyChecked.Value.AccountNumbers); Assert.IsTrue(DTHelper.IsItToday(companyChecked.Value.VerificationDate)); Assert.IsFalse(companyChecked.Value.IsGivenAccountNumOnWhiteList); companyChecked = verResults.FirstOrDefault(vr => vr.Key == companiesToCheck.ElementAt(1).Key); Assert.IsNotNull(companyChecked); Assert.AreEqual(WhiteListVerResultStatus.ActiveVATPayerButGivenAccountWrong, companyChecked.Value.VerificationStatus); Assert.IsTrue(companyChecked.Value.IsActiveVATPayer); Assert.AreEqual(companiesToCheck.ElementAt(1).Value.NIP, companyChecked.Value.Nip); Assert.IsNotNull(companyChecked.Value.AccountNumbers); Assert.IsTrue(DTHelper.IsItToday(companyChecked.Value.VerificationDate)); Assert.IsFalse(companyChecked.Value.IsGivenAccountNumOnWhiteList); for (int i = 2; i < 4; i++) { companyChecked = verResults.FirstOrDefault(vr => vr.Key == companiesToCheck.ElementAt(i).Key); Assert.IsNotNull(companyChecked); Assert.AreEqual(WhiteListVerResultStatus.ActiveVATPayerVerScuccessButGivenAccountNotVerified, companyChecked.Value.VerificationStatus); Assert.IsTrue(companyChecked.Value.IsActiveVATPayer); Assert.AreEqual(companiesToCheck.ElementAt(i).Value.NIP, companyChecked.Value.Nip); Assert.IsNotNull(companyChecked.Value.AccountNumbers); Assert.IsTrue(DTHelper.IsItToday(companyChecked.Value.VerificationDate)); Assert.IsFalse(companyChecked.Value.IsGivenAccountNumOnWhiteList); } }
public void TimeForFullListNipVerification() { DateTime startTime = DateTime.Now; _verifier.VerifyNIPs(CompanyGenerator.GetAllCompanies().Where(c => _nipsToCheck.Contains(c.NIP)).ToList()); DateTime stopTime = DateTime.Now; Assert.GreaterOrEqual((stopTime - startTime).TotalMilliseconds, 1000); }
// Use this for initialization private void Awake() { if (instance == null) { instance = this; } else { Debug.LogError("More than one Company Generator"); } }
public void InCorrectNipInput() { Dictionary <string, InputCompany> incorrectCompanies = CompanyGenerator.GetInCorrectNipCompanies(); Dictionary <string, BiRVerifyResult> verResults = _verifier.AreCompaniesActive(incorrectCompanies.Values.ToList <InputCompany>()); Assert.AreEqual(incorrectCompanies.Count, verResults.Count); Assert.AreEqual(0, incorrectCompanies.Keys.Except(verResults.Keys).Count()); foreach (var result in verResults) { Assert.AreEqual(BiRVerifyStatus.NotFound, result.Value.BiRVerifyStatus); } }
public void CorrectNipsFizyczna() { Dictionary <string, InputCompany> correctCompanies = CompanyGenerator.GetCorrectPhisicalCompanies(); Dictionary <string, BiRVerifyResult> verResults = _verifier.AreCompaniesActive(correctCompanies.Values.ToList <InputCompany>()); Assert.AreEqual(correctCompanies.Count, verResults.Count); Assert.AreEqual(0, correctCompanies.Keys.Except(verResults.Keys).Count()); foreach (var result in verResults) { Assert.AreEqual(BiRVerifyStatus.IsActive, result.Value.BiRVerifyStatus); } }
public void FullListNipVerification() { var verificationResults = _verifier.VerifyNIPs(CompanyGenerator.GetAllCompanies().Where(c => _nipsToCheck.Contains(c.NIP)).ToList()); Assert.AreEqual(VerifyNIPResult.IsActiveVATPayer, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetCorrectNIP(1)]]); Assert.AreEqual(VerifyNIPResult.IsActiveVATPayer, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetCorrectNIP(2)]]); Assert.AreEqual(VerifyNIPResult.IsActiveVATPayer, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetCorrectNIP(3)]]); Assert.AreEqual(VerifyNIPResult.IsActiveVATPayer, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetCorrectNIP(4)]]); Assert.AreEqual(VerifyNIPResult.IsActiveVATPayer, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetCorrectNIP(0)]]); Assert.AreEqual(VerifyNIPResult.NIPNotCorrect, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetInCorrectNIP(1)]]); Assert.AreEqual(VerifyNIPResult.NIPNotCorrect, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetInCorrectNIP(2)]]); Assert.AreEqual(VerifyNIPResult.NIPNotCorrect, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetInCorrectNIP(3)]]); Assert.AreEqual(VerifyNIPResult.NIPNotCorrect, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetInCorrectNIP(4)]]); Assert.AreEqual(VerifyNIPResult.NIPNotCorrect, verificationResults[CompanyGenerator.CompaniesNIPIDDic[CompanyGenerator.GetInCorrectNIP(0)]]); }
public void TestOneInCorrectNIPCompany() { var companiesToCheck = new Dictionary<string, InputCompany>(CompanyGenerator.GetCorrectCompanies()); var incorrectCompany = VerifyCompany.Common.Test.Lib.CompanyGenerator.GetInCorrectNipCompanies(); //add incorrect company companiesToCheck.Add(incorrectCompany.ElementAt(0).Value.ID, incorrectCompany.ElementAt(0).Value); Dictionary<string, WhiteListVerResult> verResults = _verifier.VerifyCompanies(companiesToCheck.Values.ToList<InputCompany>(), true, false); var companyIncorrectNipChecked = verResults.FirstOrDefault(vr => vr.Key == incorrectCompany.ElementAt(0).Value.ID); Assert.IsNotNull(companyIncorrectNipChecked); Assert.AreEqual(WhiteListVerResultStatus.ErrorNIPError, companyIncorrectNipChecked.Value.VerificationStatus); Assert.IsTrue(DTHelper.IsItToday(companyIncorrectNipChecked.Value.VerificationDate)); foreach (var companyToCheck in companiesToCheck.Where(c=>c.Key != incorrectCompany.ElementAt(0).Value.ID)) { var companyChecked = verResults.FirstOrDefault(vr => vr.Key == companyToCheck.Key); Assert.IsNotNull(companyChecked); Assert.AreEqual(WhiteListVerResultStatus.ActiveVATPayerAccountOKVerSuccessfull, companyChecked.Value.VerificationStatus); Assert.IsTrue(DTHelper.IsItToday(companyChecked.Value.VerificationDate)); } }
public void IncorrectNipVerification() { VerifyNIPResult response = _verifier.VerifyNIP(CompanyGenerator.GetInCorrectNIP(1)); Assert.AreEqual(VerifyNIPResult.NIPNotCorrect, response); }
public void OneCorrectNipVerification() { VerifyNIPResult response = _verifier.VerifyNIP(CompanyGenerator.GetCorrectNIP(1)); Assert.AreEqual(VerifyNIPResult.IsActiveVATPayer, response); }
public void Setup() { Mock <WeryfikacjaVAT> clientMock = new Mock <WeryfikacjaVAT>(); clientMock.Setup(c => c.SprawdzNIP(It.Is <SprawdzNIPZapytanie>(z => z.NIP == CompanyGenerator.GetCorrectNIP(1)))).Returns(new SprawdzNIPOdpowiedz() { WynikOperacji = new TWynikWeryfikacjiVAT() { Kod = TKodWeryfikacjiVAT.C } }); clientMock.Setup(c => c.SprawdzNIP(It.Is <SprawdzNIPZapytanie>(z => z.NIP == CompanyGenerator.GetInCorrectNIP(1)))).Returns(new SprawdzNIPOdpowiedz() { WynikOperacji = new TWynikWeryfikacjiVAT() { Kod = TKodWeryfikacjiVAT.I } }); _prevClient = WeryfikacjaVATClientFactory.GetWeryfikacjaVATClient(); WeryfikacjaVATClientFactory.SetWeryfikacjaVATClinet(clientMock.Object); _verifier = new NIPActivePayerVerifier(); }
public void IncorrectNipVerification() { VerifyNIPResult response = verifier.VerifyNIP(CompanyGenerator.GetInCorrectNIP(1)); Assert.AreEqual(VerifyNIPResult.NotRegisteredVATPayer, response); }