Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bchavez committed Apr 17, 2017
1 parent 532ae21 commit 286cd0c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,21 @@ for more info.

### Without Fluent Syntax

You can use **Bogus** without a fluent setup. Just use a dataset directly.
You can use **Bogus** without a fluent setup. Just use the `Faker` facade or a **dataset** directly.

```csharp
[Test]
public void Without_Fluent_Syntax()
public void Using_The_Faker_Facade()
{
var faker = new Faker("en");
var o = new Order()
{
OrderId = faker.Random.Number(1, 100),
Item = faker.Lorem.Sentence(),
Quantity = faker.Random.Number(1, 10)
};
o.Dump()
}
public void Or_Using_DataSets_Directly()
{
var random = new Bogus.Randomizer();
var lorem = new Bogus.DataSets.Lorem();
Expand Down
17 changes: 17 additions & 0 deletions Source/Bogus.Tests/FluentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ public void Without_Fluent_Syntax()
Item = lorem.Sentence(),
Quantity = random.Number(1, 10)
};
o.OrderId.Should().Be(61);
o.Quantity.Should().Be(7);
o.Dump();
}

[Test]
public void With_Faker_Facade()
{
var faker = new Faker("en");
var o = new Order()
{
OrderId = faker.Random.Number(1, 100),
Item = faker.Lorem.Sentence(),
Quantity = faker.Random.Number(1, 10)
};
o.OrderId.Should().Be(61);
o.Quantity.Should().Be(7);
o.Dump();
}

Expand Down

0 comments on commit 286cd0c

Please sign in to comment.