Skip to content

Instantly share code, notes, and snippets.

View merken's full-sized avatar

Maarten Merken merken

View GitHub Profile
using System;
using FluentAssertions;
using Xunit;
namespace calculation.tests
{
public class CalculationTests
{
[Theory]
[InlineData(1, 1, 2)]
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<button data-cy="first" (click)="first()" data-cy="first">First button</button>
<button data-cy="second" (click)="second()" data-cy="second">Second button</button>
<button data-cy="third" (click)="third()" data-cy="third">Third button</button>
<article data-cy="content">{{whatHappened}}</article>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
whatHappened = 'nothing';
describe('Index tests', function () {
before(function () {
// runs once before all tests in the block
})
after(function () {
// runs once after all tests in the block
})
beforeEach(function () {
import { environment } from './../environments/environment';
import { Directive, ElementRef, Renderer2 } from '@angular/core';
@Directive({
// tslint:disable-next-line:directive-selector
selector: '[data-cy]'
})
export class DataCyDirective {
constructor(private el: ElementRef, private renderer: Renderer2) {
if (environment.production) {
renderer.removeAttribute(el.nativeElement, 'data-cy');
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"datacy": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
var path = require('path');
module.exports = {
module: {
rules: [{
test: /\.html$/,
use: ['data-cy-loader']
}]
},
resolveLoader: {
module.exports = function dataCyLoader(source) {
var dataAttr= 'data-cy=\"([^"]*)\"';
if(source.match(dataAttr)){
source = source.replace(new RegExp(dataAttr, 'g'), '');
}
return source;
}
var fs = require('fs');
fs.rename('webpack.extra.js', 'webpack.extra_.js', function (err) {
if (err) console.log('ERROR: ' + err);
fs.rename('webpack.test.js', 'webpack.extra.js', function (err) {
if (err) console.log('ERROR: ' + err);
});
});
@merken
merken / Customer.cs
Created September 18, 2018 19:57
Customer and BirthDay
public class BirthDay
{
public int DayOfMonth { get; set; }
public int Month { get; set; }
public int Year { get; set; }
public int DaysToNextBirthDay()
{
var today = DateTime.Today;
var birthDayThisYear = new DateTime(today.Year, Month, DayOfMonth);