Skip to content

Instantly share code, notes, and snippets.

View Chandankkrr's full-sized avatar
🎯
Focusing

Chandan Rauniyar Chandankkrr

🎯
Focusing
View GitHub Profile
@Chandankkrr
Chandankkrr / ContentfulEntryUpdater.cs
Last active October 10, 2021 13:40
QueueTrigger Azure Function
namespace Tweetter.Functions;
public class ContentfulEntryUpdater
{
private readonly ContentfulApiOptions _options;
public ContentfulEntryUpdater(IOptions<ContentfulApiOptions> options)
{
_options = options.Value;
}
@Chandankkrr
Chandankkrr / TweetterPoster.cs
Last active October 11, 2021 11:57
QueueTrigger Azure Function
namespace Tweetter.Functions;
public class TweetterPoster
{
private readonly TwitterApiOptions _options;
public TweetterPoster(IOptions<TwitterApiOptions> options)
{
_options = options.Value;
}
@Chandankkrr
Chandankkrr / TweetterTrigger.cs
Last active October 12, 2021 10:18
TimerTrigger Azure function
namespace Tweetter.Functions;
public class TweetterTrigger
{
private readonly ContentfulApiOptions _options;
public TweetterTrigger(IOptions<ContentfulApiOptions> options)
{
_options = options.Value;
}
@Chandankkrr
Chandankkrr / MockApiResponse.cs
Last active July 25, 2021 09:22
Mocking API response using Playwright
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Playwright;
namespace ConsoleApp
{
class Program
{
@Chandankkrr
Chandankkrr / Monitoring.cs
Last active July 25, 2021 07:09
Playwright Network Monitoring
using System;
using System.Threading.Tasks;
using Microsoft.Playwright;
namespace ConsoleApp
{
class Program
{
static async Task Main(string[] args)
{
@Chandankkrr
Chandankkrr / CaptureScreenshot.cs
Created July 22, 2021 12:11
Capture page screenshot when expected container is not found during E2E test
var welcomeTextContainer = await page.QuerySelectorAsync($"text=Hello {email}");
if (welcomeTextContainer == null)
{
await page.ScreenshotAsync(
new PageScreenshotOptions
{
Path = "screenshot.png"
});
@Chandankkrr
Chandankkrr / UserRegistrationTest.cs
Last active September 6, 2022 06:55
Blazor web application E2E Testing using Playwright
using System;
using System.Threading.Tasks;
using FluentAssertions;
using Microsoft.Playwright;
using Xunit;
using Xunit.Abstractions;
using Xunit.Sdk;
namespace Asp.BlazorClient.Tests.End2End
{
@Chandankkrr
Chandankkrr / SourceGenerator.cs
Last active June 24, 2021 01:21
MediatR Source Generator
using System.Diagnostics;
using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
namespace MediatorGenerator
{
[Generator]
window.nextjs = {
updateCursor: function (connectionId, x, y) {
const el = document.getElementById(connectionId);
if (el) {
el.style.transform = `translate3d(${x}px, ${y}px, 0px)`;
}
}
}
hubConnection.On<string, string, string>("ReceiveMessage", (connectionId, x, y) => {
JSRuntime.InvokeVoidAsync("nextjs.updateCursor", connectionId, x, y);
StateHasChanged();
});