-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Customize expansion and set maps on first boot (#1425)
- Loading branch information
Showing
45 changed files
with
698 additions
and
267 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using Server.Buffers; | ||
using Server.Text; | ||
using Xunit; | ||
|
||
namespace Server.Tests.Buffers; | ||
|
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,50 @@ | ||
using Xunit; | ||
using Server.Maps; | ||
using Server.Json; | ||
using System.Text.Json.Serialization; | ||
using System.Text.Json; | ||
|
||
namespace Server.Tests.Tests.Maps | ||
{ | ||
public class MapSelectionTests | ||
{ | ||
[Theory] | ||
[InlineData(MapSelectionFlags.Felucca, "Felucca")] | ||
[InlineData(MapSelectionFlags.Felucca | MapSelectionFlags.Trammel, "Felucca, Trammel")] | ||
public void TestCommaSeparatedList(MapSelectionFlags flags, string expected) | ||
{ | ||
Assert.Equal(expected, flags.ToCommaDelimitedString()); | ||
} | ||
|
||
[Fact] | ||
public void TestFormatFeluccaOnlyMapSelection() | ||
{ | ||
const MapSelectionFlags flags = MapSelectionFlags.Felucca; | ||
|
||
// When, Then | ||
Assert.Equal("Felucca", flags.ToCommaDelimitedString()); | ||
} | ||
|
||
public class TestMapConfig | ||
{ | ||
[JsonConverter(typeof(FlagsConverter<MapSelectionFlags>))] | ||
public MapSelectionFlags TestMapFlags { get; set; } | ||
} | ||
|
||
[Fact] | ||
public void TestSerializeAndDeserializeMapSelectionFlags() | ||
{ | ||
TestMapConfig mapConfig = new() | ||
{ | ||
TestMapFlags = MapSelectionFlags.Felucca | MapSelectionFlags.Ilshenar, | ||
}; | ||
|
||
// When | ||
string serialized = JsonConfig.Serialize(mapConfig); | ||
TestMapConfig deserialized = JsonSerializer.Deserialize<TestMapConfig>(serialized, JsonConfig.GetOptions()); | ||
|
||
// Then | ||
Assert.Equal(mapConfig.TestMapFlags, deserialized.TestMapFlags); | ||
} | ||
} | ||
} |
Oops, something went wrong.