|
|
@ -1,4 +1,7 @@
|
|
|
|
using CoreLibrary.Exceptions;
|
|
|
|
using CoreLibrary.Exceptions;
|
|
|
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
|
|
|
|
|
|
using System.Text.Json;
|
|
|
|
using Xunit;
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
|
|
namespace UnitTesting
|
|
|
|
namespace UnitTesting
|
|
|
@ -22,7 +25,7 @@ namespace UnitTesting
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new CodeCompletException(message);
|
|
|
|
throw new CodeCompletException(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(CodeCompletException e)
|
|
|
|
catch (CodeCompletException e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Assert.Equal(message, e.Message);
|
|
|
|
Assert.Equal(message, e.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -50,5 +53,17 @@ namespace UnitTesting
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void ExceptionSerialisation()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CodeCompletException exception = new CodeCompletException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string jsonString = JsonSerializer.Serialize(exception);
|
|
|
|
|
|
|
|
CodeCompletException? exceptionSerialisee =
|
|
|
|
|
|
|
|
JsonSerializer.Deserialize<CodeCompletException>(jsonString);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(exceptionSerialisee);
|
|
|
|
|
|
|
|
Assert.Equal(exception.Message, exceptionSerialisee.Message);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|