-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from akkadotnet/dev
v0.9.10 Release
- Loading branch information
Showing
22 changed files
with
392 additions
and
14 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
### 0.9.9 October 10 2019 #### | ||
Hyperion now supports .NET Core 3.0. | ||
### 0.9.10 October 15 2019 #### | ||
|
||
Hyperion now [supports cross-framework communication between .NET Core and .NET Framework](https://github.com/akkadotnet/Hyperion/pull/116). |
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,37 @@ | ||
using System.IO; | ||
using Hyperion.Tests.Generator; | ||
using Xunit; | ||
|
||
namespace Hyperion.Tests | ||
{ | ||
public class CrossFrameworkSerializationTests | ||
{ | ||
private readonly Serializer _serializer; | ||
private readonly CrossFrameworkClass _originalObject; | ||
|
||
public CrossFrameworkSerializationTests() | ||
{ | ||
_serializer = new Serializer(); | ||
_originalObject = CrossFrameworkInitializer.Init(); | ||
} | ||
|
||
[Fact] | ||
public void CanSerializeCrossFramework() | ||
{ | ||
const string defaultOutputPath = CrossFrameworkInitializer.DefaultOutputPath; | ||
var testFiles = Directory.GetFiles(defaultOutputPath, "*.tf"); | ||
|
||
Assert.NotEmpty(testFiles); | ||
|
||
foreach (string testFile in testFiles) | ||
{ | ||
using (var fileStream = new FileStream(testFile, FileMode.Open)) | ||
{ | ||
var crossFrameworkClass = _serializer.Deserialize<CrossFrameworkClass>(fileStream); | ||
|
||
Assert.Equal(_originalObject, crossFrameworkClass); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,125 @@ | ||
using System; | ||
|
||
namespace Hyperion.Tests.Generator | ||
{ | ||
public class CrossFrameworkClass | ||
{ | ||
public sbyte Sbyte { get; set; } | ||
|
||
public short Short { get; set; } | ||
|
||
public int Int { get; set; } | ||
|
||
public long Long { get; set; } | ||
|
||
public byte Byte { get; set; } | ||
|
||
public ushort UShort { get; set; } | ||
|
||
public uint UInt { get; set; } | ||
|
||
public ulong ULong { get; set; } | ||
|
||
public char Char { get; set; } | ||
|
||
public float Float { get; set; } | ||
|
||
public double Double { get; set; } | ||
|
||
public decimal Decimal { get; set; } | ||
|
||
public bool Boolean { get; set; } | ||
|
||
public string String { get; set; } | ||
|
||
public DateTime DateTime { get; set; } | ||
|
||
public Exception Exception { get; set; } | ||
|
||
public CrossFrameworkEnum Enum { get; set; } | ||
|
||
public CrossFrameworkStruct Struct { get; set; } | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (!(obj is CrossFrameworkClass)) | ||
{ | ||
return false; | ||
} | ||
|
||
var objectToCompare = (CrossFrameworkClass) obj; | ||
|
||
|
||
//return Sbyte == objectToCompare.Sbyte | ||
// && Short == objectToCompare.Short | ||
// && Int == objectToCompare.Int | ||
// && Long == objectToCompare.Long | ||
// && Byte == objectToCompare.Byte | ||
// && UShort == objectToCompare.UShort | ||
// && UInt == objectToCompare.UInt | ||
// && ULong == objectToCompare.ULong | ||
// && Char == objectToCompare.Char | ||
// && Math.Abs(Float - objectToCompare.Float) < float.Epsilon | ||
// && Math.Abs(Double - objectToCompare.Double) < double.Epsilon | ||
// && Decimal == objectToCompare.Decimal | ||
// && Boolean == objectToCompare.Boolean | ||
// && String == objectToCompare.String | ||
// && DateTime == objectToCompare.DateTime | ||
// && Exception == objectToCompare.Exception | ||
// && Enum == objectToCompare.Enum | ||
// && Struct.Equals(objectToCompare.Struct); | ||
|
||
return Equals(objectToCompare); | ||
|
||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
int hashCode = Sbyte.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Short.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Int; | ||
hashCode = (hashCode * 397) ^ Long.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Byte.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ UShort.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ (int) UInt; | ||
hashCode = (hashCode * 397) ^ ULong.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Char.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Float.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Double.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Boolean.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0); | ||
hashCode = (hashCode * 397) ^ DateTime.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ (Exception != null ? Exception.GetHashCode() : 0); | ||
hashCode = (hashCode * 397) ^ (int) Enum; | ||
hashCode = (hashCode * 397) ^ Struct.GetHashCode(); | ||
return hashCode; | ||
} | ||
} | ||
|
||
private bool Equals(CrossFrameworkClass other) | ||
{ | ||
return Sbyte == other.Sbyte | ||
&& Short == other.Short | ||
&& Int == other.Int | ||
&& Long == other.Long | ||
&& Byte == other.Byte | ||
&& UShort == other.UShort | ||
&& UInt == other.UInt | ||
&& ULong == other.ULong | ||
&& Char == other.Char | ||
&& Math.Abs(Float - other.Float) < float.Epsilon | ||
&& Math.Abs(Double - other.Double) < double.Epsilon | ||
&& Decimal == other.Decimal | ||
&& Boolean == other.Boolean | ||
&& string.Equals(String, other.String) | ||
&& DateTime.Equals(other.DateTime) | ||
// && Equals(Exception, other.Exception) | ||
&& Exception.Message == other.Exception.Message | ||
&& Enum == other.Enum | ||
&& Struct.Equals(other.Struct); | ||
} | ||
} | ||
} |
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 @@ | ||
namespace Hyperion.Tests.Generator | ||
{ | ||
public enum CrossFrameworkEnum | ||
{ | ||
ShortSword, | ||
LongSword, | ||
BastardSword, | ||
Claymore, | ||
Scimitar, | ||
Yatagan, | ||
Katana | ||
} | ||
} |
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,49 @@ | ||
using System; | ||
|
||
namespace Hyperion.Tests.Generator | ||
{ | ||
public static class CrossFrameworkInitializer | ||
{ | ||
public const string DefaultOutputPath = "../../../testfiles"; | ||
|
||
public static CrossFrameworkClass Init() | ||
{ | ||
return new CrossFrameworkClass() | ||
{ | ||
Exception = new Exception("Test message", new ArgumentNullException("param", "Cannot be null")), | ||
DateTime = new DateTime(1944, 6, 6), // DDay | ||
Enum = CrossFrameworkEnum.Yatagan, | ||
String = "On June 6, 1944, more than 160,000 Allied troops landed along a 50-mile stretch of heavily-fortified French coastline", | ||
Struct = new CrossFrameworkStruct() | ||
{ | ||
Boolean = true, | ||
Long = long.MaxValue, | ||
Decimal = decimal.MinusOne, | ||
Double = double.MaxValue, | ||
Int = int.MaxValue, | ||
Short = short.MaxValue, | ||
ULong = ulong.MinValue, | ||
Byte = byte.MaxValue, | ||
Char = char.MaxValue, | ||
Float = float.MinValue, | ||
UShort = ushort.MinValue, | ||
UInt = uint.MaxValue, | ||
Sbyte = sbyte.MaxValue | ||
}, | ||
Decimal = decimal.MaxValue, | ||
Float = float.MaxValue, | ||
Long = long.MinValue, | ||
Int = int.MinValue, | ||
Double = double.Epsilon, | ||
Char = char.MaxValue, | ||
Byte = byte.MaxValue, | ||
Sbyte = sbyte.MaxValue, | ||
Short = short.MaxValue, | ||
UInt = uint.MaxValue, | ||
ULong = ulong.MaxValue, | ||
UShort = ushort.MaxValue, | ||
Boolean = true | ||
}; | ||
} | ||
} | ||
} |
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,83 @@ | ||
using System; | ||
|
||
namespace Hyperion.Tests.Generator | ||
{ | ||
public struct CrossFrameworkStruct | ||
{ | ||
public sbyte Sbyte { get; set; } | ||
|
||
public short Short { get; set; } | ||
|
||
public int Int { get; set; } | ||
|
||
public long Long { get; set; } | ||
|
||
public byte Byte { get; set; } | ||
|
||
public ushort UShort { get; set; } | ||
|
||
public uint UInt { get; set; } | ||
|
||
public ulong ULong { get; set; } | ||
|
||
public char Char { get; set; } | ||
|
||
public float Float { get; set; } | ||
|
||
public double Double { get; set; } | ||
|
||
public decimal Decimal { get; set; } | ||
|
||
public bool Boolean { get; set; } | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (!(obj is CrossFrameworkStruct)) | ||
{ | ||
return false; | ||
} | ||
|
||
var objectToCompare = (CrossFrameworkStruct)obj; | ||
|
||
return Equals(objectToCompare); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
int hashCode = Sbyte.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Short.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Int; | ||
hashCode = (hashCode * 397) ^ Long.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Byte.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ UShort.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ (int) UInt; | ||
hashCode = (hashCode * 397) ^ ULong.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Char.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Float.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Double.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); | ||
hashCode = (hashCode * 397) ^ Boolean.GetHashCode(); | ||
return hashCode; | ||
} | ||
} | ||
|
||
private bool Equals(CrossFrameworkStruct other) | ||
{ | ||
return Sbyte == other.Sbyte | ||
&& Short == other.Short | ||
&& Int == other.Int | ||
&& Long == other.Long | ||
&& Byte == other.Byte | ||
&& UShort == other.UShort | ||
&& UInt == other.UInt | ||
&& ULong == other.ULong | ||
&& Char == other.Char | ||
&& Math.Abs(Float - other.Float) < float.Epsilon | ||
&& Math.Abs(Double - other.Double) < double.Epsilon | ||
&& Decimal == other.Decimal | ||
&& Boolean == other.Boolean; | ||
} | ||
} | ||
} |
Oops, something went wrong.