-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework tests to use Moq.EFCore, working on ProjectionHelperTests
- Loading branch information
Showing
19 changed files
with
509 additions
and
207 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Bogus; | ||
using FocusCore.Models; | ||
|
||
|
||
namespace FocusAPI.Tests.Fakers.BaseModels | ||
{ | ||
internal class BaseBadgeFaker : Faker<BaseBadge> | ||
{ | ||
public BaseBadgeFaker() | ||
{ | ||
RuleFor(badge => badge.Id, f => f.Random.Guid()); | ||
RuleFor(badge => badge.Name, f => f.Random.Word()); | ||
RuleFor(badge => badge.Description, f => f.Random.Words(4)); | ||
RuleFor(badge => badge.Image, f => [0x1]); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Bogus; | ||
using FocusCore.Models; | ||
|
||
namespace FocusAPI.Tests.Fakers.BaseModels | ||
{ | ||
internal class BaseDecorFaker : Faker<BaseDecor> | ||
{ | ||
public BaseDecorFaker() | ||
{ | ||
RuleFor(decor => decor.Id, f => f.Random.Guid()); | ||
RuleFor(decor => decor.Price, f => Math.Abs(f.Random.Int())); | ||
RuleFor(decor => decor.Name, f => f.Random.Word()); | ||
RuleFor(decor => decor.HeightRequest, f => Math.Abs(f.Random.Int())); | ||
RuleFor(decor => decor.Image, f => [0x1]); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
test/FocusAPI.Tests/Fakers/BaseModels/BaseFriendshipFaker.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Bogus; | ||
using FocusCore.Models; | ||
|
||
namespace FocusAPI.Tests.Fakers.BaseModels | ||
{ | ||
internal class BaseFriendshipFaker : Faker<BaseFriendship> | ||
{ | ||
public BaseFriendshipFaker(BaseUser? user = null) | ||
{ | ||
RuleFor(friendship => friendship.UserId, f => user == null ? f.Random.Guid() : user.Id); | ||
RuleFor(friendship => friendship.FriendId, f => f.Random.Guid()); | ||
RuleFor(friendship => friendship.Status, f => 1); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Bogus; | ||
using FocusCore.Models; | ||
|
||
namespace FocusAPI.Tests.Fakers.BaseModels | ||
{ | ||
internal class BaseIslandFaker : Faker<BaseIsland> | ||
{ | ||
public BaseIslandFaker() | ||
{ | ||
RuleFor(island => island.Id, f => f.Random.Guid()); | ||
RuleFor(island => island.Price, f => Math.Abs(f.Random.Int())); | ||
RuleFor(island => island.Name, f => f.Random.Word()); | ||
RuleFor(island => island.Image, f => [0x1]); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Bogus; | ||
using FocusCore.Models; | ||
|
||
namespace FocusAPI.Tests.Fakers.ImplementedModels | ||
{ | ||
internal class BasePetFaker : Faker<BasePet> | ||
{ | ||
public BasePetFaker() | ||
{ | ||
RuleFor(pet => pet.Id, f => f.Random.Guid()); | ||
RuleFor(pet => pet.Price, f => Math.Abs(f.Random.Int())); | ||
RuleFor(pet => pet.Name, f => f.Random.Word()); | ||
RuleFor(pet => pet.Image, f => [0x1]); | ||
RuleFor(pet => pet.HeightRequest, f => Math.Abs(f.Random.Int())); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
using Bogus; | ||
using FocusAPI.Tests.Fakers.ImplementedModels; | ||
using FocusCore.Models; | ||
|
||
namespace FocusAPI.Tests.Fakers.BaseModels; | ||
internal class BaseUserBadgeFaker : Faker<BaseUserBadge> | ||
{ | ||
internal BaseUserBadgeFaker(Guid? userId = null) | ||
{ | ||
BaseBadgeFaker baseBadgeFaker = new(); | ||
BaseBadge badge = baseBadgeFaker.Generate(); | ||
RuleFor(userBadge => userBadge.UserId, f => userId ??= f.Random.Guid()); | ||
RuleFor(userBadge => userBadge.BadgeId, f => f.Random.Guid()); | ||
RuleFor(userBadge => userBadge.BadgeId, f => badge.Id); | ||
RuleFor(userBadge => userBadge.Badge, f => badge); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
using Bogus; | ||
using FocusAPI.Tests.Fakers.ImplementedModels; | ||
using FocusCore.Models; | ||
|
||
namespace FocusAPI.Tests.Fakers.BaseModels; | ||
internal class BaseUserPetFaker : Faker<BaseUserPet> | ||
{ | ||
internal BaseUserPetFaker(Guid? userId = null) | ||
{ | ||
BasePetFaker basePetFaker = new(); | ||
BasePet pet = basePetFaker.Generate(); | ||
RuleFor(userPet => userPet.UserId, f => userId ??= f.Random.Guid()); | ||
RuleFor(userPet => userPet.PetId, f => f.Random.Guid()); | ||
RuleFor(userPet => userPet.PetId, f => pet.Id); | ||
RuleFor(userPet => userPet.Pet, f => pet); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
test/FocusAPI.Tests/Fakers/ImplementedModels/FriendshipFaker.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Bogus; | ||
using FocusAPI.Models; | ||
|
||
namespace FocusAPI.Tests.Fakers.ImplementedModels | ||
{ | ||
internal class FriendshipFaker : Faker<Friendship> | ||
{ | ||
public FriendshipFaker(User? user = null) | ||
{ | ||
RuleFor(friendship => friendship.UserId, f => user == null ? f.Random.Guid() : user.Id); | ||
RuleFor(friendship => friendship.FriendId, f => f.Random.Guid()); | ||
RuleFor(friendship => friendship.Status, f => 1); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.