dotnet-installer/src/Microsoft.Extensions.Testing.Abstractions/LineDelimitedJsonStream.cs

25 lines
655 B
C#
Raw Normal View History

2015-12-01 00:24:03 +00:00
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.IO;
using Newtonsoft.Json;
namespace Microsoft.Extensions.Testing.Abstractions
{
public class LineDelimitedJsonStream
2015-12-01 00:24:03 +00:00
{
private readonly StreamWriter _stream;
public LineDelimitedJsonStream(Stream stream)
{
_stream = new StreamWriter(stream);
}
public void Send(object @object)
{
_stream.WriteLine(JsonConvert.SerializeObject(@object));
_stream.Flush();
}
}
}