Posts

Showing posts from April, 2024

Azure DevOps Notes

 Azure Dev Ops: Repo:     Repos > Files shows what is on Master. Stuff does not get here until "Pull Request" is approved. Pipeline section - Pipeline:    Pipeline is the overall process that will happen on each of the environments.    Pipeline creating process has Configure step that you pick your selected YAML    Pipeline running creates an "artifact" Pipelines > Pipelines =>  RemoteOrder API => click blue "Run Pipeline" button       => select branch which should now have "Mine" with "stories/360094" under which you pick       => click blue "Run" button in SE      => Wait again for it to go from Queued to Success for all      => remember the pipeline id and # Pipeline section - Releases: REJECT TO FREE UP DEV BOX    Must reject prior release on that box (Dev or one of the others) first even, if you were the last to release to th...

Swagger

Image
 http://localhost:8187/swagger/ui/index in browser where 8187 is the port and VS app is running.

Curl to C#

Curl is shipped by Microsoft  as part of Windows 10 and 11.   Curl: curl -X GET --header "Accept: application/json" "https://localhost:8187/pricechange/test" C# equivalent: using System.Net.Http; HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://localhost:8187/pricechange/test" ); request.Headers.Add( "Accept" , "application/json" ); HttpResponseMessage response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync();

Software Shops - External vs Internal

  External  Software Shops -    1) Have to make UX pretty for marketing.   2) Have to make UX super simple because employees read docs while customers do not.   3) Have user help in the app so it is first line of support.   4) Have to make  customizations for large clients , pursuing clients with marketing features,  or clients with different needs.   5) Requires  lots of configurations   6) Each configuration requires  case/switch statements and conditionals in code.   7) Must have great product versioning if not auto-updating because certain clients could be behind on installing latest.   8) Might turn on or off modules based on what the client has paid.   9 ) Licensing and licensing agreements are critical to ensure getting paid.    Internal Shops -   1) Don't have baggage of customizations for large clients, pursuing clients with marketing features,  or clients with different needs. ...

Visual Studio - Git, Testing, and NuGet Packages

 Visual Studio:    Git:       On VS 2022, make sure that Visual Studio Installer has "Code Tools" > "Git for Windows" checked so that it is fully installed.  Even partially installed you can clone down to the box, it correctly shows changes, and even allows committing changes. However, it has problems pushing.  VS says success when pushing but fails to push anything and the changes are remain visible as committed but not pushed and thus cleared out.       Also make sure you are pointing to correct code branch at the bottom VS task bar.   Testing - Code Coverage:     In Test Explorer => click on top level of tests => click "Analyze Code Coverage".     Click on coverage line to drill down. Keep drilling until know the biggest "Not Covered" and add tests for it and repeat.   Testing - Exception Testing:    Say how to mock when call is hit. If NSubstitute then:    _service.Updat...

Names - "Edge Cases" for testing

  Forms often can't deal with people who only have one name, or a single-letter surname. Jennifer Null’s husband had warned her before they got married that taking his name could lead to occasional frustrations in everyday life.  Consider also the experiences of Janice Keihanaikukauakahihulihe'ekahaunaele, a Hawaiian woman who complained that state ID cards should allow citizens to display surnames even as long as hers – which is 36 characters in total . Break is length Break is single apostrophe especially in MS SQL Server.   https://www.bbc.com/future/article/20160325-the-names-that-break-computer-systems   Character Problems Scott O’Neal is another example. Philip Blonde’ is another example. The extended ASCII is required for some foreign names.   Length Problems: Donna-Lee Gonsalves-Barriero is another example. Mrs Penny Randriamahavorisoa is another example. Lughaidh Mac Giolla Bhrighde is another example Venk...

Postman testing

  WHEN VISUAL STUDIO RUNS API,    Look at browser it starts up and note the URL address and specifically the port such as: https://localhost:52334/ .   Your local environment will need to match this. LOCAL TESTING - COMMON PROBLEMS:   1) Must run the API in VS when do Postman so it will process. Breakpoints will work.      Failure to run is error: connect ECONNREFUSED 127.0.0.1:5212 .   2) Make empty body of {   } . Exception is when the endpoint needs data.       Example error is "No MediaTypeFormatter is available to read an object of type 'InputData'." when it wants InputData.   3) Controller's method's attribute signature such as:  [HttpPost("pricing/sellingprices")]      should match Postman request:       POST   {{BaseUrl}}/notify/        Example error is "405 Method Not Allowed".   4) Controller's method's [FromBody] param...

NET 8 Host Controllers that run the API Services

  /// <summary> Generic for any API solution </summary> [ExcludeFromCodeCoverage] public abstract class ControllerSubBase(ILogger logger) : ControllerBase() {     private readonly ILogger _logger = logger;     protected IActionResult HandleModelStateBadRequest()     {         var modelStateErrors = ModelState.Select(x => x.Value?.Errors).Where(y => y != null && y.Count > 0);         _logger.LogWarning("Invalid ModelState {modelStateErrors}",JsonSerializer.Serialize(modelStateErrors));         return BadRequest(modelStateErrors);     }     protected void LogError(Exception ex, string location)     {         _logger.LogError(ex, "[E] " + location + " Failed: {error}", ex.Message);     }} ================================================== /// <summary> Generic for any API solution </summary> [Excl...

Store vs Corp

 1) Need MSI on store side.  No MST on corporate needed. 2) App Settings different:      appsettings.Store-Development.json      appsettings.Store-Staging.json      appsettings.Store.json 3) Need to adjust so reads newer JSON: var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development"; var builder = new ConfigurationBuilder().SetBasePath(AppContext.BaseDirectory)     .AddJsonFile("appsettings.json", optional: false, reloadOnChange: false)     .AddJsonFile($"appsettings.Store-{environment}.json", optional: false)     .AddEnvironmentVariables(); IConfiguration configuration = builder.Build(); services.AddSingleton(s => configuration); 4) Use the later Wix 4 5) Adjust for the fact that application is using the win10-x64 runtime with Net 6 whereas yours is win-x64 6) Ensure version numbers are done correctly 7) Don't forget to view MSI contents using Orca