QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
418 lines
16 KiB
C#
418 lines
16 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.ServiceModel.Security;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Administration.Settings;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.Logistics.Warehousing;
|
|
using Centron.BusinessLogic.Warehousing;
|
|
using Centron.BusinessLogic.WebServices.CustomerArea;
|
|
using Centron.BusinessLogic.WebServices.Logistics.Warehousing;
|
|
using Centron.BusinessLogic.WebServices.Warehousing;
|
|
using Centron.Core.Extensions;
|
|
using Centron.Data.Entities.Administration;
|
|
using Centron.Data.Entities.Administration.Logins;
|
|
using Centron.Data.Entities.Logistics.Warehousing;
|
|
using Centron.Data.Entities.Sales.Receipts.Articles;
|
|
using Centron.Data.Entities.Warehousing.Barcode2;
|
|
using Centron.Data.Entities.Warehousing.StockManagement;
|
|
using Centron.Data.WebServices.Warehousing;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Interfaces.CustomerArea;
|
|
using Centron.Interfaces.Logistics.Warehousing;
|
|
using Centron.Interfaces.Warehousing;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Centron.Tests.EndToEnd.Infrastructure.Verifier;
|
|
using CentronSoftware.Centron.WebServices.Entities.Sales.Support.RmaArea;
|
|
using DevExpress.CodeParser;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.Rma
|
|
{
|
|
public class RmaTest : EndToEndTest
|
|
{
|
|
public RmaTest(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
this.Verifier.Settings.IgnoreProperty<RmaDTO>(f => f.CreatedDate);
|
|
this.Verifier.Settings.IgnoreProperty<RmaDTO>(f => f.CreatedVersion);
|
|
this.Verifier.Settings.IgnoreProperty<RmaDTO>(f => f.ChangedDate);
|
|
this.Verifier.Settings.IgnoreProperty<RmaDTO>(f => f.ChangedVersion);
|
|
this.Verifier.Settings.IgnoreProperty<RmaArticleDTO>(f => f.CreatedDate);
|
|
this.Verifier.Settings.IgnoreProperty<RmaArticleDTO>(f => f.CreatedVersion);
|
|
this.Verifier.Settings.IgnoreProperty<RmaArticleDTO>(f => f.ChangedDate);
|
|
this.Verifier.Settings.IgnoreProperty<RmaArticleDTO>(f => f.ChangedVersion);
|
|
this.Verifier.Settings.IgnoreProperty<RmaSendBackDTO>(f => f.CreatedDate);
|
|
this.Verifier.Settings.IgnoreProperty<RmaSendBackDTO>(f => f.CreatedVersion);
|
|
this.Verifier.Settings.IgnoreProperty<RmaSendBackDTO>(f => f.ChangedDate);
|
|
this.Verifier.Settings.IgnoreProperty<RmaSendBackDTO>(f => f.ChangedVersion);
|
|
this.Verifier.Settings.IgnoreProperty<RmaSendForthDTO>(f => f.CreatedDate);
|
|
this.Verifier.Settings.IgnoreProperty<RmaSendForthDTO>(f => f.CreatedVersion);
|
|
this.Verifier.Settings.IgnoreProperty<RmaSendForthDTO>(f => f.ChangedDate);
|
|
this.Verifier.Settings.IgnoreProperty<RmaSendForthDTO>(f => f.ChangedVersion);
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
var newRma = this. CreateNewRmaArticle(Interfaces.CustomerArea.RmaKind.OwnRma);
|
|
var searchedArticleCode = this.SearchRmaArticleByArticleCode(Interfaces.CustomerArea.RmaKind.CustomerRma);
|
|
BarcodeUmbuchen();
|
|
var searchedSerialNumber = this.SearchRmaArticleBySerialNumber(Interfaces.CustomerArea.RmaKind.OwnRma);
|
|
var newRmaWithArticle = this.AddArticleToRma(newRma, searchedSerialNumber);
|
|
var savedRma = this.SaveRma(newRmaWithArticle);
|
|
this.GetRmaOverview();
|
|
this.VerifyBarcodeBoocking(savedRma);
|
|
this.VerifySecondaryStockArticle(savedRma);
|
|
this.VerifyArticleLog(savedRma);
|
|
|
|
this.GetSendKinds(1);
|
|
this.SaveSendKind();
|
|
|
|
var newSendBackRma = this.GetNewSendBackRma(savedRma);
|
|
var savedSendBackRma = this.SaveSendBackRma(newSendBackRma);
|
|
this.GetRmaSendBacksByFilter(savedSendBackRma.Number);
|
|
|
|
var newSendForthRma = this.GetNewSendFortfRma(savedSendBackRma);
|
|
var savedSendForthRmaI3D = this.SaveSendForthRma(newSendForthRma);
|
|
this.GetRmaSendForthByFilter(savedSendForthRmaI3D);
|
|
}
|
|
|
|
private RmaDTO CreateNewRmaArticle(Interfaces.CustomerArea.RmaKind rmaKind)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var rma = session.GetBL<RmaWebServiceBL>().GetNewRma(this.GetLoggedInUser());
|
|
|
|
Assert.NotNull(rma);
|
|
Assert.Equal(ResultStatus.Success, rma.Status);
|
|
this.Verifier.Verify("CreateNewRma", rma.Data);
|
|
|
|
rma.Data.AccountName = "centron software gmbh";
|
|
rma.Data.AccountI3D = 1;
|
|
rma.Data.AccountAddressI3D = 1;
|
|
rma.Data.AccountAddressContactPersonI3D = 2;
|
|
rma.Data.Description = "Hier steht die RMA Fehlerbeschreibung";
|
|
rma.Data.RmaKind= rmaKind;
|
|
|
|
rma.Data.HelpdeskI3D = 5;
|
|
|
|
return rma.Data;
|
|
}
|
|
}
|
|
|
|
private RmaDTO AddArticleToRma(RmaDTO rma, IList<RmaArticleSearchDTO> searchedSerialNumbers)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
int i = 0;
|
|
var stock = session.DAOSession.GetGenericDAO<Stock>().GetEntity(f => f.Kind == StockKind.RmaCustomer);
|
|
foreach (var searchedArticle in searchedSerialNumbers)
|
|
{
|
|
|
|
var rmaArticle = session.GetBL<RmaWebServiceBL>().CreateNewRmaArticle(searchedArticle, this.GetLoggedInUser());
|
|
rmaArticle.Data.Quantity= 1;
|
|
rmaArticle.Data.ForthWarehouseI3D = stock.I3D;
|
|
if (i == 0)
|
|
{
|
|
Assert.NotNull(rmaArticle);
|
|
Assert.Equal(ResultStatus.Success, rmaArticle.Status);
|
|
this.Verifier.Verify("RmaArticle", rmaArticle.Data);
|
|
}
|
|
i++;
|
|
rma.Articles.Add(rmaArticle.Data);
|
|
}
|
|
return rma;
|
|
}
|
|
}
|
|
|
|
private RmaDTO SaveRma(RmaDTO rma)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var savedRma = session.GetBL<RmaWebServiceBL>().SaveRma(rma, this.GetLoggedInUser());
|
|
|
|
Assert.NotNull(savedRma);
|
|
Assert.Equal(ResultStatus.Success, savedRma.Status);
|
|
|
|
this.Verifier.Verify("SavedRma", savedRma.Data);
|
|
|
|
return savedRma.Data;
|
|
}
|
|
}
|
|
|
|
private void GetRmaOverview()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var rmaData = session.GetBL<RmaWebServiceBL>().GetRmaOverview(new RmaSearchFilter(), this.GetLoggedInUser());
|
|
|
|
Assert.NotNull(rmaData);
|
|
Assert.Equal(ResultStatus.Success, rmaData.Status);
|
|
|
|
this.Verifier.Verify("RmaOverview", rmaData.Data);
|
|
}
|
|
}
|
|
|
|
private IList<RmaArticleSearchDTO> SearchRmaArticleByArticleCode(Interfaces.CustomerArea.RmaKind rmaKind)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var filter = new RmaArticleSearchFilter
|
|
{
|
|
SearchText = "toner",
|
|
ArticleSearchKind = RmaArticleSearchKind.ArticleCode,
|
|
RmaKind= rmaKind
|
|
};
|
|
var rmaArticles = session.GetBL<RmaWebServiceBL>().RmaArticleSearch(filter);
|
|
|
|
Assert.NotNull(rmaArticles);
|
|
Assert.Equal(ResultStatus.Success, rmaArticles.Status);
|
|
|
|
this.Verifier.Verify("RmaArticleSearchByArticleCode", rmaArticles.Data);
|
|
|
|
return rmaArticles.Data;
|
|
}
|
|
}
|
|
|
|
private void BarcodeUmbuchen()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var barcode = session.GetBL<BarcodeBL>().GetBarCode2ByI3D(54);
|
|
barcode.StockI3D = 6;
|
|
session.DAOSession.GetGenericDAO<BarCode2>().SaveOrUpdate(barcode);
|
|
|
|
var secondaryStock = new ArticleStockCompact()
|
|
{
|
|
ArticleI3D = 37,
|
|
SecondaryStockI3D = 6,
|
|
Stock = 1,
|
|
CreatedAt= DateTime.Today
|
|
|
|
};
|
|
session.DAOSession.GetGenericDAO<ArticleStockCompact>().Save(secondaryStock);
|
|
}
|
|
}
|
|
|
|
private IList<RmaArticleSearchDTO> SearchRmaArticleBySerialNumber(Interfaces.CustomerArea.RmaKind rmaKind)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var filter = new RmaArticleSearchFilter
|
|
{
|
|
CustomerNumber = 10000,
|
|
SearchText = "RG",
|
|
ArticleSearchKind = RmaArticleSearchKind.SerialNumber,
|
|
RmaKind = rmaKind
|
|
};
|
|
|
|
var rmaArticles = session.GetBL<RmaWebServiceBL>().RmaArticleSearch(filter);
|
|
|
|
Assert.NotNull(rmaArticles);
|
|
Assert.Equal(ResultStatus.Success, rmaArticles.Status);
|
|
|
|
this.Verifier.Verify("RmaArticleSearchBySerialNumber", rmaArticles.Data);
|
|
|
|
return rmaArticles.Data;
|
|
}
|
|
}
|
|
|
|
private void VerifyBarcodeBoocking(RmaDTO savedRma)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var filter = new BarCode2Filter()
|
|
{
|
|
BarcodeI3Ds = savedRma.Articles.Select(f => f.SerialNumber.I3D).ToList(),
|
|
};
|
|
|
|
var barcodeResult = session.GetBL<BarcodeWebServiceBL>().SearchBarCode2ThroughPaging(filter, 1, int.MaxValue);
|
|
|
|
Assert.NotNull(barcodeResult);
|
|
|
|
this.Verifier.Verify("BarcodeChanges", barcodeResult);
|
|
}
|
|
}
|
|
|
|
private void VerifySecondaryStockArticle(RmaDTO savedRma)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var setting = session.GetBL<AppSettingsBL>().GetSettings(AppSettingsConst.RMAOwnStorage);
|
|
var stockI3D = setting.GetInt(AppSettingsConst.RMAOwnStorage);
|
|
|
|
var exisitingSecondaryStock = session.GetBL<SecondStockArticleWebServiceBL>().GetSecondaryStockArticle(new SecondaryStockArticleFilter
|
|
{
|
|
ArticleI3Ds = savedRma.Articles.Select(f => f.Article.I3D).ToArray(),
|
|
SecondaryStockI3D = stockI3D
|
|
});
|
|
|
|
Assert.NotNull(exisitingSecondaryStock);
|
|
|
|
this.Verifier.Verify("SecondaryStockBookings", exisitingSecondaryStock);
|
|
}
|
|
}
|
|
|
|
private void VerifyArticleLog(RmaDTO savedRma)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var filter = new ArticleLogFilter
|
|
{
|
|
ArticleI3Ds = savedRma.Articles.Select(f => f.Article.I3D).ToArray()
|
|
};
|
|
var articleLog = session.GetBL<ArticleLogWebServiceBL>().GetArticleLogs(filter);
|
|
|
|
Assert.NotNull(articleLog);
|
|
|
|
this.Verifier.Verify("ArticleLog", articleLog);
|
|
}
|
|
}
|
|
|
|
private void GetSendKinds(int version)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var sendKinds = session.GetBL<RmaSendKindWebServiceBL>().GetSendKinds();
|
|
|
|
Assert.NotNull(sendKinds);
|
|
Assert.Equal(ResultStatus.Success, sendKinds.Status);
|
|
|
|
this.Verifier.Verify($"SendKinds_{version}", sendKinds.Data);
|
|
}
|
|
}
|
|
|
|
private void SaveSendKind()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var sendKind = new RmaSendKindDTO
|
|
{
|
|
Name = "Aliexpress"
|
|
};
|
|
|
|
var saved = session.GetBL<RmaSendKindWebServiceBL>().SaveSendKinds(new List<RmaSendKindDTO>
|
|
{
|
|
sendKind
|
|
});
|
|
|
|
Assert.NotNull(saved);
|
|
Assert.Equal(ResultStatus.Success, saved.Status);
|
|
|
|
this.GetSendKinds(2);
|
|
}
|
|
}
|
|
|
|
private RmaSendBackDTO GetNewSendBackRma(RmaDTO rma)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var newSendBackResult = session.GetBL<RmaWebServiceBL>().GetNewRmaSendBack(rma.Articles, rma.Articles.First().SupplierNumber.Value, rma.I3D, null, null, new DateTime(2022, 1 ,1), this.GetLoggedInUser());
|
|
|
|
Assert.NotNull(newSendBackResult);
|
|
Assert.Equal(ResultStatus.Success, newSendBackResult.Status);
|
|
|
|
this.Verifier.Verify("NewSendBackRma", newSendBackResult.Data);
|
|
|
|
return newSendBackResult.Data;
|
|
}
|
|
}
|
|
|
|
private RmaSendForthDTO GetNewSendFortfRma(RmaSendBackDTO newSendBackRma)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var setting = session.GetBL<AppSettingsBL>().GetSettings(AppSettingsConst.RMAOwnStorage);
|
|
int stockI3D = setting.GetInt(AppSettingsConst.RMAOwnStorage).GetValueOrDefault();
|
|
RmaSendForthDTO sendForth = new RmaSendForthDTO();
|
|
|
|
var senBackArticle = newSendBackRma.Articles.First();
|
|
sendForth.SendDate = DateTime.Today;
|
|
sendForth.ReturnDate = DateTime.Today.AddDays(5);
|
|
sendForth.RmaI3D = newSendBackRma.RmaI3D;
|
|
sendForth.RmaSendBackI3D = newSendBackRma.I3D;
|
|
|
|
var sendForthArticle = new RmaSendForthArticleDTO();
|
|
sendForthArticle.RmaArticle = newSendBackRma.Articles.First().RmaArticle;
|
|
sendForthArticle.RmaArticle.ForthAction = RmaForthAction.EqualChange;
|
|
sendForthArticle.RmaArticle.SwapSerialNumber = new SerialNumberDTO() { Name = "Test_SN" };
|
|
sendForthArticle.RmaArticle.ForthWarehouseI3D = stockI3D;
|
|
sendForthArticle.RmaSendBackItemI3D = senBackArticle.I3D;
|
|
sendForth.Articles.Add(sendForthArticle);
|
|
|
|
|
|
return sendForth;
|
|
}
|
|
}
|
|
|
|
private RmaSendBackDTO SaveSendBackRma(RmaSendBackDTO newSendBackRma)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var savedRma = session.GetBL<RmaWebServiceBL>().SaveRmaSendBack(newSendBackRma, this.GetLoggedInUser());
|
|
|
|
Assert.NotNull(savedRma);
|
|
Assert.Equal(ResultStatus.Success, savedRma.Status);
|
|
|
|
this.Verifier.Verify("SaveSendBackRma", savedRma.Data);
|
|
|
|
return savedRma.Data;
|
|
}
|
|
}
|
|
|
|
private int SaveSendForthRma(RmaSendForthDTO newSendForhRma)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var savedRma = session.GetBL<RmaWebServiceBL>().SaveRmaSendForth(newSendForhRma, this.GetLoggedInUser());
|
|
|
|
Assert.NotNull(savedRma);
|
|
Assert.Equal(ResultStatus.Success, savedRma.Status);
|
|
|
|
this.Verifier.Verify("SaveSendForthRma", savedRma.Data);
|
|
|
|
return savedRma.Data.I3D;
|
|
}
|
|
}
|
|
|
|
private void GetRmaSendBacksByFilter(int savedSendBackRmaNumber)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var filter = new RmaSearchFilter
|
|
{
|
|
Number = savedSendBackRmaNumber
|
|
};
|
|
|
|
var sendBackRma = session.GetBL<RmaWebServiceBL>().GetRmaSendBacksByFilter(filter);
|
|
|
|
Assert.NotNull(sendBackRma);
|
|
Assert.Equal(ResultStatus.Success, sendBackRma.Status);
|
|
|
|
this.Verifier.Verify("GetRmaSendBackByFilter", sendBackRma.Data);
|
|
}
|
|
}
|
|
|
|
private void GetRmaSendForthByFilter(int savedSendForthRmaI3D)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var filter = new RmaSearchFilter
|
|
{
|
|
I3D = savedSendForthRmaI3D
|
|
};
|
|
|
|
var sendBackRma = session.GetBL<RmaWebServiceBL>().GetRmaSendForthByFilter(filter);
|
|
|
|
Assert.NotNull(sendBackRma);
|
|
Assert.Equal(ResultStatus.Success, sendBackRma.Status);
|
|
|
|
this.Verifier.Verify("GetRmaSendForthByFilter", sendBackRma.Data);
|
|
}
|
|
}
|
|
}
|
|
}
|