Compare commits
No commits in common. "bd1d7f65cb2b52115b40166b3cb412e3df702b1e" and "b432da5b5925fd0501ab17aa21b70d6997625e5c" have entirely different histories.
bd1d7f65cb
...
b432da5b59
|
|
@ -411,30 +411,10 @@ namespace TIAM.Database.Test
|
||||||
Assert.IsNotNull(transfer.TransferToDrivers[0].Car);
|
Assert.IsNotNull(transfer.TransferToDrivers[0].Car);
|
||||||
|
|
||||||
Assert.AreEqual(transfer.OrderId, 1);
|
Assert.AreEqual(transfer.OrderId, 1);
|
||||||
|
|
||||||
Assert.IsTrue(transfer.Id == transferId, "transfer.Id != transferId");
|
Assert.IsTrue(transfer.Id == transferId, "transfer.Id != transferId");
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
|
||||||
[DataRow(["4CBAED43-2465-4D99-84F1-C8BC6B7025F7", "71392CFD-FB9C-45C1-9540-7BE3782CF26A"])]
|
|
||||||
public async Task GetTransfersByDriver_ReturnsTransfers_WhenHasTransfers(string[] driverUserIdUserProductMappingIdString)
|
|
||||||
{
|
|
||||||
var driverUserId = Guid.Parse(driverUserIdUserProductMappingIdString[0]);
|
|
||||||
var userProductMappingId = Guid.Parse(driverUserIdUserProductMappingIdString[1]);
|
|
||||||
|
|
||||||
var transfers = await Dal.GetTransfersByUserProductMappingIdAsync(userProductMappingId);
|
|
||||||
|
|
||||||
Assert.IsNotNull(transfers);
|
|
||||||
Assert.IsTrue(transfers.Count > 0);
|
|
||||||
Assert.IsNotNull(transfers.All(x => x.TransferToDrivers.Any(ttd => ttd.UserProductMappingId == userProductMappingId)));
|
|
||||||
|
|
||||||
var count = transfers.Count;
|
|
||||||
transfers = await Dal.GetTransfersByDriverUserIdAsync(driverUserId);
|
|
||||||
|
|
||||||
Assert.IsNotNull(transfers);
|
|
||||||
Assert.IsTrue(transfers.Count == count);
|
|
||||||
Assert.IsNotNull(transfers.All(x => x.TransferToDrivers.Any(ttd => ttd.UserProductMappingId == userProductMappingId)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow("273EFE3C-D19F-4C2A-BF19-7397DC835C60")]
|
[DataRow("273EFE3C-D19F-4C2A-BF19-7397DC835C60")]
|
||||||
public void GetTransferDestionationById_ReturnsTransferDestination_WhenHasAddressRelation(string transferDestinationIdString)
|
public void GetTransferDestionationById_ReturnsTransferDestination_WhenHasAddressRelation(string transferDestinationIdString)
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,6 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
|
|
||||||
public Task<List<Transfer>> GetTransfersByFilterAsync(CriteriaOperator criteriaOperator) => SessionAsync(ctx => (ctx.GetTransfers().AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator) as IQueryable<Transfer>)!.ToList());
|
public Task<List<Transfer>> GetTransfersByFilterAsync(CriteriaOperator criteriaOperator) => SessionAsync(ctx => (ctx.GetTransfers().AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator) as IQueryable<Transfer>)!.ToList());
|
||||||
|
|
||||||
public Task<List<Transfer>> GetTransfersByDriverUserIdAsync(Guid driverUserId)
|
|
||||||
=> SessionAsync(ctx => ctx.GetTransfers().Where(x => x.TransferToDrivers.Any(ttd => ttd.UserProductMapping.UserId == driverUserId)).ToList());
|
|
||||||
|
|
||||||
public Task<List<Transfer>> GetTransfersByUserProductMappingIdAsync(Guid userProductMappingId)
|
public Task<List<Transfer>> GetTransfersByUserProductMappingIdAsync(Guid userProductMappingId)
|
||||||
=> SessionAsync(ctx => ctx.GetTransfers().Where(x => x.TransferToDrivers.Any(ttd => ttd.UserProductMappingId == userProductMappingId)).ToList());
|
=> SessionAsync(ctx => ctx.GetTransfers().Where(x => x.TransferToDrivers.Any(ttd => ttd.UserProductMappingId == userProductMappingId)).ToList());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue