Skip to content

Commit

Permalink
#28: Synergy.Contracts: Test files rename
Browse files Browse the repository at this point in the history
Also changed NUnit to XUnit
  • Loading branch information
MarcinCelej committed Feb 17, 2024
1 parent 0346603 commit 9c7eb0c
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 104 deletions.
80 changes: 80 additions & 0 deletions Contracts/Synergy.Contracts.Test/Failures/Because/Fail.Because.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using Synergy.Contracts.Samples.Domain;
using Xunit;

namespace Synergy.Contracts.Test.Failures.Because;

public class FailBecauseTest
{
[Fact]
public void BecauseWith0Arguments()
{
// ACT
var exception = Fail.Because("Always");

// ASSERT
Assert.NotNull(exception);
Assert.Equal("Always", exception.Message);
}

[Fact]
public void BecauseWith1Argument()
{
// ACT
// ReSharper disable once HeapView.BoxingAllocation
var exception = Fail.Because("Always {0}", 1);

// ASSERT
Assert.NotNull(exception);
Assert.Equal("Always 1", exception.Message);
}

[Fact]
public void BecauseWith2Arguments()
{
// ACT
// ReSharper disable once HeapView.BoxingAllocation
var exception = Fail.Because("Always {0} {1}", "fails", 1);

// ASSERT
Assert.NotNull(exception);
Assert.Equal("Always fails 1", exception.Message);
}

[Fact]
public void BecauseWith3Arguments()
{
// ACT
// ReSharper disable once HeapView.BoxingAllocation
var exception = Fail.Because("Always {0} {1} {2}", "fails", 1, "times");

// ASSERT
Assert.NotNull(exception);
Assert.Equal("Always fails 1 times", exception.Message);
}

[Fact]
public void BecauseWithNArguments()
{
// ACT
// ReSharper disable once HeapView.BoxingAllocation
var exception = Fail.Because("Always {0} {1} {2} {3}", "fails", 1, "times", "frequently");

// ASSERT
Assert.NotNull(exception);
Assert.Equal("Always fails 1 times frequently", exception.Message);
}

[Fact]
public void BecauseSample()
{
// ARRANGE
var contractor = new Contractor();

// ACT
var exception = Assert.Throws<DesignByContractViolationException>(
() => contractor.SetPersonName("Marcin", "Celej"));

// ASSERT
Assert.Equal("Not implemented yet", exception.Message);
}
}
18 changes: 0 additions & 18 deletions Contracts/Synergy.Contracts.Test/Failures/FailBecauseTest.cs

This file was deleted.

86 changes: 0 additions & 86 deletions Contracts/Synergy.Contracts.Test/Failures/FailTest.cs

This file was deleted.

0 comments on commit 9c7eb0c

Please sign in to comment.