This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PdfGenerator | |
{ | |
public async Task GeneratePdfAsync(string htmlContent) | |
{ | |
// generate PDF from HTML content | |
} | |
} | |
public class MyClass | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PdfGenerationCommandHandlerTests | |
{ | |
[Fact] | |
public async Task Handle_ShouldGeneratePdf_WhenValidCommandProvided() | |
{ | |
// Arrange | |
var command = new PdfGenerationCommand { HtmlContent = "<html><body><h1>Hello World!</h1></body></html>" }; | |
var requestHandler = new Mock<IRequestHandler<PdfGenerationCommand, PdfGenerationResponse>>(); | |
requestHandler.Setup(x => x.Handle(It.IsAny<PdfGenerationCommand>(), It.IsAny<CancellationToken>(), It.IsAny<IProgress<int>>())) | |
.ReturnsAsync(new PdfGenerationResponse { PdfContent = new byte[] { 1, 2, 3 }, DocumentId = "abc" }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task GeneratePdfCommandHandler_Should_Generate_Pdf() | |
{ | |
// Arrange | |
var htmlContent = "<html><body><h1>Test</h1></body></html>"; | |
var pdfGenerator = new Mock<IPdfGenerator>(); | |
pdfGenerator.Setup(x => x.GeneratePdfAsync(htmlContent)) | |
.ReturnsAsync(new byte[] { 0x25, 0x50, 0x44, 0x46 }); | |
var commandHandler = new GeneratePdfCommandHandler(pdfGenerator.Object); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PdfGenerationRequestHandler : IRequestHandler<PdfGenerationCommand, PdfGenerationResponse> | |
{ | |
private readonly IPdfGenerator _pdfGenerator; | |
public PdfGenerationRequestHandler(IPdfGenerator pdfGenerator) | |
{ | |
_pdfGenerator = pdfGenerator; | |
} | |
public async Task<PdfGenerationResponse> Handle(PdfGenerationCommand command, CancellationToken cancellationToken, IProgress<int> progress) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PdfGenerationCommand : ICommand | |
{ | |
public string HtmlContent { get; set; } | |
} | |
public class PdfGenerationCommandHandler : CommandHandler<PdfGenerationCommand> | |
{ | |
private readonly IPdfGenerator _pdfGenerator; | |
private CancellationTokenSource _cancellationTokenSource; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as R from 'Ramda'; | |
namespace Main { | |
export interface Order { | |
Amount: number | |
Name: string | |
} | |
export interface Discount { | |
Apply: (amount: number) => number; | |
IsValid: (order: Order) => boolean; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using System.Threading.Channels; | |
using System.Threading.Tasks; | |
using Couchbase.Lite; | |
namespace ChannelQueue | |
{ | |
class DocumentWriter : IDisposable | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AvatarImageSource : StreamImageSource | |
{ | |
public override bool IsEmpty => string.IsNullOrEmpty(Name); | |
protected override void OnPropertyChanged(string propertyName) | |
{ | |
if (propertyName == NameProperty.PropertyName || | |
propertyName == BackgroundProperty.PropertyName || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace TimeTable.App.Views | |
{ | |
public class TimeSlotDTO | |
{ | |
public int Day { get; set; } | |
public double Start { get; set; } | |
public double End { get; set; } | |
public string Place { get; set; } | |
public string Course { get; set; } | |
public int Students { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.EntityFrameworkCore; | |
using TimeTable.Core.Models; | |
using TimeTableServer.Context; | |
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 |
NewerOlder