-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
StubManager can instantiate generic classes now
- Loading branch information
1 parent
947d679
commit 10b5a01
Showing
9 changed files
with
156 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace StubGenerator.Test.Models | ||
{ | ||
public class GenericModel<T> where T : class | ||
{ | ||
public int Status { get; set; } | ||
|
||
public T Data { get; set; } | ||
} | ||
} |
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,12 @@ | ||
namespace StubGenerator.Test.Models | ||
{ | ||
public class GenericModel<T1, T2> | ||
where T1 : class | ||
where T2 : class | ||
{ | ||
public int Status { get; set; } | ||
|
||
public T1 GenericOne { get; set; } | ||
public T2 GenericTwo { get; set; } | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/StubMiddleware.Core/Core/Conventions/CountryConventionMap.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,13 @@ | ||
using System; | ||
using System.Reflection; | ||
using StubGenerator.Core.FakeDataGenerators; | ||
|
||
namespace StubGenerator.Core.Conventions | ||
{ | ||
public class CountryConventionMap : IConventionMap | ||
{ | ||
public Predicate<PropertyInfo> Condition => w => w.PropertyType == typeof(string) && w.Name.ToLowerInvariant().Contains("country"); | ||
|
||
public IValueGenerator Generator => new CountryValueGenerator(); | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/StubMiddleware.Core/Core/Conventions/StreetNameConventionMap.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,13 @@ | ||
using System; | ||
using System.Reflection; | ||
using StubGenerator.Core.FakeDataGenerators; | ||
|
||
namespace StubGenerator.Core.Conventions | ||
{ | ||
public class StreetNameConventionMap : IConventionMap | ||
{ | ||
public Predicate<PropertyInfo> Condition => w => w.PropertyType == typeof(string) && w.Name.ToLowerInvariant().Contains("street"); | ||
|
||
public IValueGenerator Generator => new StreetNameValueGenerator(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/StubMiddleware.Core/Core/Conventions/ZipCodeConventionMap.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,13 @@ | ||
using System; | ||
using System.Reflection; | ||
using StubGenerator.Core.FakeDataGenerators; | ||
|
||
namespace StubGenerator.Core.Conventions | ||
{ | ||
public class ZipCodeConventionMap : IConventionMap | ||
{ | ||
public Predicate<PropertyInfo> Condition => w => w.PropertyType == typeof(string) && (w.Name.ToLowerInvariant().Contains("zipcode")); | ||
|
||
public IValueGenerator Generator => new ZipCodeValueGenerator(); | ||
} | ||
} |
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
49 changes: 48 additions & 1 deletion
49
src/StubMiddleware.Core/Extensions/StubManagerExtensions.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