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
static State ChangeState(State current, Transition transition, bool hasKey) | |
{ | |
if (current == Opened && transition == Close) | |
return Closed; | |
else if (current == Closed && transition == Open) | |
return Open; | |
else if (current == Closed && transition == Lock && hasKey) | |
return Locked; | |
else if (current == Locked && transition == Unlock && hasKey) | |
return Closed; |
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 Calculator | |
open System | |
module Calculator = | |
type Operator = | |
| Add | |
| Subtract | |
| Multiply | |
| Divide |
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
Feature: Calculator | |
Scenario: Adding numbers | |
Given there is a calculator | |
And the user entered 2 in the calculator | |
And the user selected + as the operation | |
And the user entered 2 in the calculator | |
When the user presses the = button | |
Then the calculator shows 4 as the result |
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
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp2.2</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.AspNetCore.All" /> | |
</ItemGroup> |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFramework>net462</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" /> | |
<PackageReference Include="NUnit" Version="3.10.1" /> | |
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" /> |
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
// depends on BenchmarkDotNet 0.10.10 | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Attributes.Jobs; | |
using BenchmarkDotNet.Running; |
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 interface IEventSourced | |
{ | |
IReadOnlyCollection<object> AppendedEvents { get; } | |
void ReplayEvent(object @event); | |
} | |
public abstract class EventSourcedBase: IEventSourced | |
{ | |
protected void AppendEvent<T>(T @event) | |
{ |
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
Scenario: Reschedule an appointment | |
Given an appointment was created for 2016-11-03T13:00 until 2016-11-03T14:00 called Appointment | |
And the appointment was renamed to Renamed appointment | |
When we reschedule the appointment to 2016-11-03T15:00 until 2016-11-03T16:00 | |
Then an AppointmentRescheduled event is appended with the following properties: | |
| Start time | End time | | |
| 2016-11-03T15:00 | 2016-11-03T16:00 | |
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
private AppointmentCreated CreateAppointmentCreatedEvent() | |
{ | |
return new AppointmentCreated( | |
appointmentId: Guid.NewGuid(), | |
startTime: DateTimeOffset.Now.AddHours(3), | |
endTime: DateTimeOffset.Now.AddHours(4), | |
title: "Appointment"); | |
} | |
private AppointmentRenamed CreateAppointmentRenamedEvent() |
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 FluentAssertions; | |
using Xunit; | |
// ReSharper disable InconsistentNaming | |
namespace FluentAssertionsBugProof | |
{ | |
public class ShouldBeEquivalentToTest | |
{ | |
[Fact] |
NewerOlder