public void ConstructorWithMessageSucceeds() { var ex = new EntityNotFoundException(ErrorMessage); Assert.Equal(ErrorMessage, ex.Message); Assert.Null(ex.InnerException); Assert.Equal(Guid.Empty, ex.Id); }
public void ConstructorWithMessageAndIdSucceeds() { var ex = new EntityNotFoundException(ErrorMessage, Id); Assert.Contains(ErrorMessage, ex.Message); Assert.Contains(Id.ToString(), ex.Message); Assert.Null(ex.InnerException); Assert.Equal(Id, ex.Id); }
public void SerializeAndDeserializeSucceeds() { var ex = new EntityNotFoundException(ErrorMessage, Id, InnerException); var stream = new MemoryStream(); var formatter = new BinaryFormatter(); formatter.Serialize(stream, ex); stream.Position = 0; var result = (EntityNotFoundException)formatter.Deserialize(stream); Assert.Equal(ex.Message, result.Message); Assert.Equal(ex.InnerException.Message, result.InnerException.Message); Assert.Equal(ex.Id, result.Id); }