improvements, fixes, etc...
This commit is contained in:
parent
84e1acaa86
commit
a000d58914
|
|
@ -219,7 +219,7 @@
|
|||
private Task LoadComboBoxItems()
|
||||
{
|
||||
//TODO: CarModelDtoMin-t megcsinálni és azt lekérni a ComboBox-hoz! - J.
|
||||
return AdminSignalRClient.GetAllCarsAndDriversByProductIdAsync(_cars, _drivers, TiamConstClient.TransferProductId, StateHasChanged);
|
||||
return AdminSignalRClient.GetAllCarsAndDriversByProductIdAsync(TiamConstClient.TransferProductId, _cars, _drivers, StateHasChanged);
|
||||
}
|
||||
|
||||
private void DataItemChanged(GridDataItemChangedEventArgs<TransferToDriver> args)
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ namespace TIAMWebApp.Shared.Application.Services
|
|||
return await GetAllAsync<List<Car>>(SignalRTags.GetAllCarsByProductId, [productId]) ?? [];
|
||||
}
|
||||
|
||||
public Task GetAllCarsAndDriversByProductIdAsync(List<Car> intoCars, List<UserProductMapping> intoDrivers, Guid productId, Action? callback = null)
|
||||
public Task GetAllCarsAndDriversByProductIdAsync(Guid productId, List<Car> intoCars, List<UserProductMapping> intoDrivers, Action? callback = null)
|
||||
{
|
||||
return GetAllCarsByProductIdAsync(intoCars, productId, () =>
|
||||
return GetAllCarsByProductIdAsync(productId, intoCars, () =>
|
||||
{
|
||||
intoDrivers.Clear();
|
||||
intoDrivers.AddRange(intoCars.DistinctBy(x => x.UserProductMappingId).Select(x => x.UserProductMapping));
|
||||
|
|
@ -54,7 +54,7 @@ namespace TIAMWebApp.Shared.Application.Services
|
|||
});
|
||||
}
|
||||
|
||||
public Task GetAllCarsByProductIdAsync(List<Car> intoCars, Guid productId, Action? callback = null)
|
||||
public Task GetAllCarsByProductIdAsync(Guid productId, List<Car> intoCars, Action? callback = null)
|
||||
{
|
||||
Logger.Detail($"GetAllCarsByProductIdAsync client called; productId: {productId}");
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@ using Azure;
|
|||
using DevExpress.Data.Filtering;
|
||||
using DevExpress.Data.Linq;
|
||||
using DevExpress.Data.Linq.Helpers;
|
||||
using TIAM.Core.Consts;
|
||||
using TIAM.Core.Enums;
|
||||
using TIAM.Core.Loggers;
|
||||
using TIAM.Database.Test;
|
||||
using TIAM.Entities.Drivers;
|
||||
using TIAM.Entities.ServiceProviders;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Entities.Users;
|
||||
|
|
@ -28,11 +30,13 @@ namespace Tiam.Services.Client.Tests
|
|||
|
||||
[TestInitialize]
|
||||
public void TestInitialize()
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TearDown()
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(CompanyIdString)]
|
||||
|
|
@ -130,7 +134,7 @@ namespace Tiam.Services.Client.Tests
|
|||
transferDest.Address.AddressText = modifiedAddress;
|
||||
|
||||
transferDest = await _signalRClient.PostDataAsync(SignalRTags.UpdateTransferDestination, transferDest);
|
||||
|
||||
|
||||
Assert.IsNotNull(transferDest);
|
||||
Assert.IsNotNull(transferDest.Address);
|
||||
|
||||
|
|
@ -176,12 +180,12 @@ namespace Tiam.Services.Client.Tests
|
|||
var transferDestinationToProducts = await _signalRClient.GetByIdAsync<List<TransferDestinationToProduct>>(SignalRTags.GetTransferDestinationToProductsByTransferDestinationId, transferDestId);
|
||||
Assert.IsNotNull(transferDestinationToProducts);
|
||||
Assert.IsTrue(transferDestinationToProducts.Count > 0);
|
||||
Assert.IsTrue(transferDestinationToProducts.All(x=>x.TransferDestinationId == transferDestId));
|
||||
Assert.IsTrue(transferDestinationToProducts.All(x => x.TransferDestinationId == transferDestId));
|
||||
|
||||
transferDestinationToProducts = await _signalRClient.GetByIdAsync<List<TransferDestinationToProduct>>(SignalRTags.GetTransferDestinationToProductsByProductId, productId);
|
||||
Assert.IsNotNull(transferDestinationToProducts);
|
||||
Assert.IsTrue(transferDestinationToProducts.Count > 0);
|
||||
Assert.IsTrue(transferDestinationToProducts.All(x=>x.ProductId == productId));
|
||||
Assert.IsTrue(transferDestinationToProducts.All(x => x.ProductId == productId));
|
||||
|
||||
await _signalRClient.PostDataAsync(SignalRTags.RemoveTransferDestinationToProduct, transferDestinationToProduct); //mielõbb kitöröljük, h ne maradjon szemét a db-ben - J.
|
||||
|
||||
|
|
@ -199,16 +203,16 @@ namespace Tiam.Services.Client.Tests
|
|||
var criteriaString = CriteriaOperator.FromLambda<Transfer>(x => x.UserId == userId && statuses.Contains(x.TransferStatusType)).ToString();
|
||||
|
||||
//var criteria = CriteriaOperator.Parse(criteriaString);
|
||||
|
||||
|
||||
//_signalRDataSource.AsQueryable().Expression.
|
||||
//var filteredData = new List<Transfer>().AsQueryable().AppendWhere(converter, criteria) as IQueryable<Transfer>;
|
||||
|
||||
var transfers = await _signalRClient.GetAllAsync<List<Transfer>>(SignalRTags.GetTransfersByFilterText, [criteriaString]);
|
||||
var transfers = await _signalRClient.GetTransfersByFilterText(criteriaString);
|
||||
//var transfers = await _signalRClient.GetAllAsync<List<Transfer>>(SignalRTags.GetTransfersByExpression, [userId, filteredData!.Expression]);
|
||||
|
||||
Assert.IsNotNull(transfers);
|
||||
Assert.IsTrue(transfers.Count > 0);
|
||||
Assert.IsTrue(transfers.All(x=>statuses.Contains(x.TransferStatusType)));
|
||||
Assert.IsTrue(transfers.All(x => statuses.Contains(x.TransferStatusType)));
|
||||
|
||||
//var converter = new CriteriaToExpressionConverter();
|
||||
////CriteriaOperator critOps = CriteriaOperator.Parse(tdashboard.EmployeeFilter);
|
||||
|
|
@ -227,5 +231,46 @@ namespace Tiam.Services.Client.Tests
|
|||
//Assert.IsNotNull(filteredTransfers);
|
||||
//Assert.IsTrue(filteredTransfers.All(x => x.LuggageCount == 1));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetAllTransfersTest_ReturnTransfers_WhenHasTransfers()
|
||||
{
|
||||
var transfers = await _signalRClient.GetTransfers();
|
||||
|
||||
Assert.IsNotNull(transfers);
|
||||
Assert.IsTrue(transfers.Count > 0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[DataRow("540271F6-C604-4C16-8160-D5A7CAFEDF00")]
|
||||
public async Task GetTransfersByUserIdTest_ReturnTransfers_WhenAllTransfersByUserId(string userIdString)
|
||||
{
|
||||
var userId = Guid.Parse(userIdString);
|
||||
var transfers = await _signalRClient.GetTransfersByUserId(userId);
|
||||
|
||||
Assert.IsNotNull(transfers);
|
||||
|
||||
Assert.IsTrue(transfers.Count > 0);
|
||||
Assert.IsTrue(transfers.All(x => x.UserId == userId));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[DataRow("")]
|
||||
public async Task GetAllCarsAndDriversByProductIdAsyncTest_ReturnCarsAndDrivers_WhenHasCarsAndDrivers(string productIdString)
|
||||
{
|
||||
var cars = new List<Car>();
|
||||
var drivers = new List<UserProductMapping>();
|
||||
var productId = TiamConstClient.TransferProductId; //Guid.Parse(productIdString);
|
||||
|
||||
await _signalRClient.GetAllCarsAndDriversByProductIdAsync(productId, cars, drivers);
|
||||
|
||||
await TaskHelper.WaitToAsync(() => drivers.Count > 0, 5000, 50);
|
||||
|
||||
Assert.IsTrue(cars.Count > 0);
|
||||
Assert.IsTrue(drivers.Count > 0);
|
||||
|
||||
Assert.IsTrue(cars.All(car => drivers.Any(driver => driver.Id == car.UserProductMappingId && driver.ProductId == productId)));
|
||||
Assert.IsTrue(drivers.All(driver => driver.ProductId == productId && cars.Any(car => car.UserProductMappingId == driver.Id)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue