OukiShogun
OukiShogun
CC#
Created by OukiShogun on 1/10/2024 in #help
How run ms test sequentially not in parallel
Hello, I want to run ms test in queue, not in parallel. On VS and on my azur pipeline. Is it possible ?
6 replies
CC#
Created by OukiShogun on 11/30/2023 in #help
Field required but I don't mention "required" above
Hello there, I have a problem. My field is considered as required by .net but I don't created it as required.
public abstract class ScheduledJobBaseDto
{
/// <summary>
/// Job group name
/// </summary>
public string JobGroupName { get; set; }

//...
}

public class ScheduledJobWriteDto : ScheduledJobBaseDto
{
}
public abstract class ScheduledJobBaseDto
{
/// <summary>
/// Job group name
/// </summary>
public string JobGroupName { get; set; }

//...
}

public class ScheduledJobWriteDto : ScheduledJobBaseDto
{
}
Below my controller
[SwaggerRequestExample(typeof(ScheduledJobWriteDtoDefault), typeof(ScheduledJobWriteDto))]
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> Post(ScheduledJobWriteDto writeDto)
{
try
{
var readDto = await this._jobService.CreateScheduledJobAsync(writeDto);

// Build URI
string uri = $"{Request.Scheme}://{Request.Host}{Request.Path}{Request.QueryString}/{writeDto.JobName}";

return Created(uri, readDto);
} // ...
}
[SwaggerRequestExample(typeof(ScheduledJobWriteDtoDefault), typeof(ScheduledJobWriteDto))]
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> Post(ScheduledJobWriteDto writeDto)
{
try
{
var readDto = await this._jobService.CreateScheduledJobAsync(writeDto);

// Build URI
string uri = $"{Request.Scheme}://{Request.Host}{Request.Path}{Request.QueryString}/{writeDto.JobName}";

return Created(uri, readDto);
} // ...
}
And the response { "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1", "title": "One or more validation errors occurred.", "status": 400, "traceId": "00-5588746f27392f4367a0d759b70b8f78-20699cede6741c50-00", "errors": { "JobGroupName": [ "The JobGroupName field is required." ] } } I don't understand why. Can someone help me please
5 replies
CC#
Created by OukiShogun on 8/1/2023 in #help
❔ Which database for integration test using db transactions
Hi there, I am coding my integration test project. And I want to test the transactionnal aspect of two functions called. I installed sqllite inmemory on my project. And set it in memory I well mocked my the last function called before the commit and do a .throw(new Exception()); and context.rollbackTransaction() in the catch. But I get a "no such table : Buy" when I run my test. I don't understand why I will have to do migration on a inmemory database. For me, it's a no-sense. So, what do you advise me to use for my test ? in prod I use sql server
13 replies
CC#
Created by OukiShogun on 7/13/2023 in #help
❔ What is the question to ask for placing a class inside Core ou Infrastructure project
I sometimes hear that infrastructure project must contains only class who communicate with external services. (Database, Redis, SQL Server). Other times that Core must contains only interface. How to decide ? For exemple, I have a handmade mediator class. Where must I place it ?
2 replies
CC#
Created by OukiShogun on 7/13/2023 in #help
❔ Should I test my mediator class ?
Hello, Should I Test my mediator class ? I ask the question because it manage interaction between domaines services. PS : I don't use MediatR
11 replies
CC#
Created by OukiShogun on 6/21/2023 in #help
❔ Tph strategy and fluent api. How to specify that a property of child class is required
2 replies