-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Platform.Memory does not require Platform.WindowsAPI anymore. Refacto…
…ring of Platform.Helpers and Platform.Tests (added some tests to ensure refactorings does not break anything).
- Loading branch information
Showing
12 changed files
with
79 additions
and
50 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
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
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,18 @@ | ||
using Platform.Helpers; | ||
using Xunit; | ||
|
||
namespace Platform.Tests.Helpers | ||
{ | ||
public class MathHelpersTests | ||
{ | ||
[Theory] | ||
[InlineData(00, -1)] // 0000 0000 (none, -1) | ||
[InlineData(01, 00)] // 0000 0001 (first, 0) | ||
[InlineData(08, 03)] // 0000 1000 (forth, 3) | ||
[InlineData(88, 03)] // 0101 1000 (forth, 3) | ||
public void GetLowestBitPosition(ulong value, int expectedPosition) | ||
{ | ||
Assert.True(MathHelpers.GetLowestBitPosition(value) == expectedPosition); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Platform/Platform.Tests/Helpers/SerializationHelpersTests.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,28 @@ | ||
using System.IO; | ||
using Platform.Helpers; | ||
using Xunit; | ||
|
||
namespace Platform.Tests.Helpers | ||
{ | ||
public class SerializationHelpersTests | ||
{ | ||
[Fact] | ||
public void SerializeToFileTest() | ||
{ | ||
var tempFilename = Path.GetTempFileName(); | ||
|
||
SerializationHelpers.SerializeToFile(tempFilename, new object()); | ||
|
||
Assert.True(File.ReadAllText(tempFilename) == "<?xml version=\"1.0\"?>\r\n<anyType xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" />"); | ||
|
||
File.Delete(tempFilename); | ||
} | ||
|
||
[Fact] | ||
public void SerializeAsXmlStringTest() | ||
{ | ||
var serializedObject = SerializationHelpers.SerializeAsXmlString(new object()); | ||
Assert.True(serializedObject == "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<anyType xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" />"); | ||
} | ||
} | ||
} |
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,3 +1,4 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CLI/@EntryIndexedValue">CLI</s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CSV/@EntryIndexedValue">CSV</s:String></wpf:ResourceDictionary> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CSV/@EntryIndexedValue">CSV</s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IL/@EntryIndexedValue">IL</s:String></wpf:ResourceDictionary> |