-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: MonoSingleton and MonoBehaviourCallback improvements (#112)
* fix: solid MonoBehaviourCallback impl + MonoSingleton fix * fix: made MonoSingleton.Instantiate method private, added test for single Instance validation * chore: incremented version to 2.0.0 due to breaking changes
- Loading branch information
1 parent
99a71f5
commit 15b85d3
Showing
6 changed files
with
95 additions
and
20 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 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using NUnit.Framework; | ||
using StansAssets.Foundation.Patterns; | ||
|
||
namespace StansAssets.Foundation.Tests.Patterns | ||
{ | ||
class TestSingleton : MonoSingleton<TestSingleton> | ||
{ | ||
public readonly string Id; | ||
|
||
public TestSingleton() | ||
{ | ||
Id = Guid.NewGuid().ToString(); | ||
} | ||
} | ||
|
||
public class MonoSingletonTests | ||
{ | ||
[Test] | ||
public void SingleInstanceTest() | ||
{ | ||
var a = TestSingleton.Instance; | ||
var b = TestSingleton.Instance; | ||
var c = TestSingleton.Instance; | ||
Assert.IsTrue(a.Id.Equals(b.Id) && b.Id.Equals(c.Id)); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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