-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* test, and fix * undo unused change * neaten up hint message * not using list of candidates in message any more * shorten test name
- Loading branch information
1 parent
2e94c03
commit c47bd8e
Showing
2 changed files
with
44 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Memstate.Configuration; | ||
using NUnit.Framework; | ||
using System.Threading.Tasks; | ||
|
||
namespace Memstate.Test.EngineBuilderTests | ||
{ | ||
[TestFixture] | ||
class BuildTests | ||
{ | ||
internal class TestSerializers : Serializers | ||
{ | ||
internal TestSerializers() | ||
{ | ||
RegisteredProviders.Remove("Wire"); | ||
RegisteredProviders.Remove("NewtonSoft.Json"); | ||
} | ||
} | ||
|
||
[Test] | ||
public async Task WhenNoSerializers_BuildShould_ReturnErrorMessageContainingSuggestedPackagesToReference() | ||
{ | ||
// pretend this is a new users project and no defaults could be loaded | ||
// remove the default storage providers that will be picked up | ||
// because this test project references Wire and JsonNet, | ||
var config = Config.Reset(); | ||
config.Serializers = new TestSerializers(); | ||
|
||
try | ||
{ | ||
var engine = await new EngineBuilder().Build<List<int>>(); | ||
Assert.Fail("Should not get here"); | ||
} | ||
catch (Exception ex) | ||
{ | ||
StringAssert.Contains("Please check to see if you need to add a reference to 'Memstate.Wire', or 'Memstate.JsonNet'. Adding any of these two nuget packages will automatically use either package for serialisation.", ex.Message); | ||
} | ||
} | ||
} | ||
} |