Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyOrman authored Apr 29, 2022
1 parent 1d18479 commit dc9178d
Show file tree
Hide file tree
Showing 415 changed files with 1,727 additions and 1,618 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.{cs,vb}]
dotnet_sort_system_directives_first = false
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void Add(IBuilderItem builderItem)
{
_builderItems.Add(builderItem);
}

public IBuilder AddAndReturn(IBuilderItem builderItem)
{
_builderItems.Add(builderItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public BuilderItem(string value)
{
_value = value;
}

public string GetValue()
{
return _value;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ConditionalCreator(
_creatorA = creatorA;
_creatorB = creatorB;
}

public Entity Create(EntityParameters entityParameters)
{
if (_conditionalCreatorSettings.ReturnA)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public ConditionalCreatorSettings(bool returnA)
{
ReturnA = returnA;
}

public bool ReturnA { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ public class Creator : ICreator
{
public Entity Create(EntityParameters entityParameters)
{
var nextId = 1;

return new Entity(
1,
entityParameters.Name);
Expand All @@ -19,7 +17,7 @@ public Entity CreateWithNameRequired(EntityParameters entityParameters)
{
throw new ArgumentNullException();
}

return Create(entityParameters);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public Entity(
}

public int Id { get; }

public string Name { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public EntityParameters(string name)
{
Name = name;
}

public string Name { get; }
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace XpressTest.Examples.Src;
public interface IBuilder
{
void Add(IBuilderItem builderItem);

IBuilder AddAndReturn(IBuilderItem builderItem);

string Build();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ namespace XpressTest.Examples.Src;

public interface IMessage
{

}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace XpressTest.Examples.Src;
public interface IMessageClientFactory
{
IMessageClient Create();

IMessageClient Create(string topic);
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ IMessageClientAsyncFactory messageClientAsyncFactory
{
_messageClientAsyncFactory = messageClientAsyncFactory;
}

public async Task PublishAsync(IMessage message)
{
var messageClient = _messageClientAsyncFactory.Create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ string topic
{
Topic = topic;
}

public string Topic { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ ICreator creator
_creator = creator;
}

public Entity Process(EntityParameters entityParameters)
public Entity? Process(EntityParameters entityParameters)
{
if(_validator.IsValid(entityParameters))
if (_validator.IsValid(entityParameters))
{
return _creator.Create(entityParameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ ICreatorAsync creatorAsync
_creatorAsync = creatorAsync;
}

public async Task<Entity> Process(EntityParameters entityParameters)
public async Task<Entity?> Process(EntityParameters entityParameters)
{
if(_validator.IsValid(entityParameters))
if (_validator.IsValid(entityParameters))
{
return await _creatorAsync.CreateAsync(entityParameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MessageSettings messageSettings
_messageClientFactory = messageClientFactory;
_messageSettings = messageSettings;
}

public void Publish(IMessage message)
{
var messageClient = _messageClientFactory.Create(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void BuildItems_Example1() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBe("abc");

[Fact]
public void BuildItems_Example2() =>
GivenA<Builder>
Expand All @@ -34,7 +34,7 @@ public void BuildItems_Example2() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetTheMockObject<IBuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBe("abc");

[Fact]
public void BuildItems_Example3() =>
GivenA<Builder>
Expand All @@ -46,7 +46,7 @@ public void BuildItems_Example3() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBeA<string>();

[Fact]
public void BuildItems_Example4() =>
GivenA<Builder>
Expand All @@ -58,7 +58,7 @@ public void BuildItems_Example4() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBeA<string>();

[Fact]
public void BuildItems_Example5() =>
GivenA<Builder>
Expand All @@ -70,7 +70,7 @@ public void BuildItems_Example5() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>()))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBeA<string>();

[Fact]
public void BuildItems_Example6() =>
GivenA<Builder>
Expand All @@ -82,7 +82,7 @@ public void BuildItems_Example6() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBeA<string>();

[Fact]
public void BuildItems_Example7() =>
GivenA<Builder>
Expand All @@ -97,7 +97,7 @@ public void BuildItems_Example7() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBe("abc");

[Fact]
public void BuildItems_Example8() =>
GivenA<Builder>
Expand All @@ -112,7 +112,7 @@ public void BuildItems_Example8() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBe("abc");

[Fact]
public void BuildItems_Example9() =>
GivenA<Builder>
Expand All @@ -127,8 +127,8 @@ public void BuildItems_Example9() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>()))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBe("abc");


[Fact]
public void BuildItems_Example10() =>
GivenA<Builder>
Expand All @@ -143,8 +143,8 @@ public void BuildItems_Example10() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBe("abc");


[Fact]
public void BuildItems_Example11() =>
GivenA<Builder>
Expand All @@ -159,7 +159,7 @@ public void BuildItems_Example11() =>
.ThenWhenIt(arrangement => arrangement.Sut.Add(arrangement.GetThe<BuilderItem>("BuilderItem3")))
.ThenWhenIt(sut => sut.Build())
.ThenTheResultShouldBe("abc");

[Fact]
public void BuildItems_Example12() =>
GivenA<Builder>
Expand All @@ -181,14 +181,14 @@ public void AddItemAndReturn_Example1() =>
.AndGivenA<IBuilderItem>()
.WhenIt(arrangement => arrangement.Sut.AddAndReturn(arrangement.GetTheMockObject<IBuilderItem>()))
.ThenTheResultShouldBe(arrangement => arrangement.Sut);

[Fact]
public void AddItemAndReturn_Example2() =>
GivenA<Builder>
.AndGivenA<IBuilderItem>()
.WhenIt<IBuilder>(arrangement => sut => sut.AddAndReturn(arrangement.GetTheMockObject<IBuilderItem>()))
.ThenTheResultShouldBe(arrangement => arrangement.Sut);

[Fact]
public void AddItem() =>
GivenA<Builder>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void MultiplyNumbers_Example2() =>
GivenA<Calculator>
.WhenIt(calculator => calculator.Multiply(3, 2))
.ThenTheResultShouldBe(6);

[Fact]
public void MultiplyNumbers_Example3() =>
GivenA<Calculator>
Expand All @@ -26,7 +26,7 @@ public void MultiplyNumbers_Example3() =>
{
Assert.Equal(6, assertion.Result);
});

[Fact]
public void MultiplyNumbers_Example4() =>
GivenA<Calculator>
Expand All @@ -36,7 +36,7 @@ public void MultiplyNumbers_Example4() =>
arrangement.GetThe<int>("Value1"),
arrangement.GetThe<int>("Value2")))
.ThenTheResultShouldBe(6);

[Fact]
public void MultiplyNumbers_Example5() =>
GivenA<Calculator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void UseCreatorA_Example1() =>
.WithA<ICreator>("CreatorB")
.WhenIt(arrangement => arrangement.Sut.Create(arrangement.GetThe<EntityParameters>()))
.ThenTheResultShouldBe(arrangement => arrangement.GetThe<Entity>());

[Fact]
public void UseCreatorA_Example2() =>
GivenA<ConditionalCreator>
Expand All @@ -37,7 +37,7 @@ public void UseCreatorA_Example2() =>
.Should(creator => creator.Create(It.IsAny<EntityParameters>()))
.Never()
.ThenTheResultShouldBe(arrangement => arrangement.GetThe<Entity>());

[Fact]
public void UseCreatorA_Example3() =>
GivenA<ConditionalCreator>
Expand All @@ -56,7 +56,7 @@ public void UseCreatorA_Example3() =>
.Should(creator => creator.Create(It.IsAny<EntityParameters>()))
.Never()
.ThenTheResultShouldBe(arrangement => arrangement.GetThe<Entity>());

[Fact]
public void UseCreatorB_Example1() =>
GivenA<ConditionalCreator>
Expand All @@ -69,7 +69,7 @@ public void UseCreatorB_Example1() =>
.AndReturns(arrangement => arrangement.GetThe<Entity>())
.WhenIt(arrangement => arrangement.Sut.Create(arrangement.GetThe<EntityParameters>()))
.ThenTheResultShouldBe(arrangement => arrangement.GetThe<Entity>());

[Fact]
public void UseCreatorB_Example2() =>
GivenA<ConditionalCreator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public void CreateEntity_Example1() =>
.WhenIt(arrangement => arrangement.Sut.Create(arrangement.GetThe<EntityParameters>()))
.ThenTheResult(result => result.Id).ShouldBe(1)
.ThenTheResult(result => result.Name).ShouldBe("EntityName");

[Fact]
public void CreateEntity_Example2() =>
GivenA<Creator>
Expand All @@ -32,7 +32,7 @@ public void CreateEntity_Example3() =>
.WhenIt(arrangement => arrangement.Sut.Create(arrangement.GetThe<EntityParameters>("ParametersToUse")))
.ThenTheResult(result => result.Id).ShouldBe(1)
.ThenTheResult(result => result.Name).ShouldBe(arrangement => arrangement.GetThe<string>("EntityNameToUse"));

[Fact]
public void CreateEntity_Example4() =>
GivenA<Creator>
Expand Down Expand Up @@ -71,7 +71,7 @@ public void CreateEntity_Example7()
var parameters = new EntityParameters("EntityName");

var entity = new Entity(1, "EntityName");

GivenA<Creator>
.WhenIt().Create(parameters)
.ThenTheResultShouldBeEquivalentTo(entity);
Expand All @@ -83,23 +83,23 @@ public void CreateEntity_Example8() =>
.AndGiven(new EntityParameters("EntityName"))
.WhenIt(arrangement => arrangement.Sut.Create(arrangement.GetThe<EntityParameters>()))
.ThenTheResultShouldNotBeNull();

[Fact]
public void CreateEntity_Example9() =>
GivenA<Creator>
.AndGiven(new EntityParameters("EntityName"))
.WhenIt<Entity>(arrangement => sut => sut.Create(arrangement.GetThe<EntityParameters>()))
.ThenTheResult(result => result.Id).ShouldBe(1)
.ThenTheResult(result => result.Name).ShouldBe("EntityName");

[Fact]
public void CreateEntity_NullProperty_Example1() =>
GivenA<Creator>
.AndGiven(new EntityParameters(null))
.WhenIt(arrangement => arrangement.Sut.Create(arrangement.GetThe<EntityParameters>()))
.ThenTheResult(result => result.Id).ShouldBe(1)
.ThenTheResult(result => result.Name).ShouldBeNull();

[Fact]
public void CreateEntity_NullProperty_Example2() =>
GivenA<Creator>
Expand Down
Loading

0 comments on commit dc9178d

Please sign in to comment.