ConfusedPenguin
ConfusedPenguin
CC#
Created by ConfusedPenguin on 8/9/2024 in #help
Chunking both key and value from dictionary
Hi all, I have a very specific problem of needing to chunk both key AND value of a dictionary (could be any data type). Scenario: I need to export and import a bunch of time series data from one tenant to a different one. The case is that I fetch say 500 Keys, where each key can have a range from 0..? count of values. The time series database service only allow bathc inserts of 100 keys, with 20,000 values per key in each insert. I need to chunk the request prior to creating the request to maintain the aforementioned rules. How would you do this efficiently?
4 replies
CC#
Created by ConfusedPenguin on 11/24/2022 in #help
❔ Check response size of http (gRPC) calls
Hi, anyone aware if it possible to determine response size of gRPC responses? I am currently encountering: Grpc.Core.RpcException: Status(StatusCode="ResourceExhausted", Detail="Received message exceeds the maximum configured message size.") but I am not sure how large the message actually is. (The response is coming from third party service, so not possible to determine). Would Fiddler or similar be able to trace that perhaps?
2 replies
CC#
Created by ConfusedPenguin on 10/7/2022 in #help
Mocking derived class with abstract base class
Hi, I have the following setup:
**BASE CLASS**
public abstract class SomeBaseAbstractClass<TItem, TResponse>
{
protected EctocloudCosmosRepository(IMapper mapper, IRepository<TItem> repository, ILogger logger)
{
_mapper = mapper;
_repository = repository;
_logger = logger;
}

public async Task<TResponse> GetAsync(string id, CancellationToken token)
{
// some logic removed for brevity
}
}

**IMPLEMENTED CLASS**
public class Repository : SomeBaseAbstractClass<Item, Response>
{
// ctor
// methods
}

**CONTROLLER**
public async Task<ActionResult> GetSomeStuff(
[FromRoute] string id,
[FromServices] Repository repository)
{
var response = await repository.GetAsync(id, HttpContext.RequestAborted);
return HandleResponse(response);
}
**BASE CLASS**
public abstract class SomeBaseAbstractClass<TItem, TResponse>
{
protected EctocloudCosmosRepository(IMapper mapper, IRepository<TItem> repository, ILogger logger)
{
_mapper = mapper;
_repository = repository;
_logger = logger;
}

public async Task<TResponse> GetAsync(string id, CancellationToken token)
{
// some logic removed for brevity
}
}

**IMPLEMENTED CLASS**
public class Repository : SomeBaseAbstractClass<Item, Response>
{
// ctor
// methods
}

**CONTROLLER**
public async Task<ActionResult> GetSomeStuff(
[FromRoute] string id,
[FromServices] Repository repository)
{
var response = await repository.GetAsync(id, HttpContext.RequestAborted);
return HandleResponse(response);
}
Now I would like to unit test GetSomeStuff, and ensuring correct HTTP status codes are returned based on response from .GetAsync() method. How would I unit test this?
5 replies