public void ReadJson_should_return_expected_result_when_using_wrapped_json_reader(string json, int?nullableTimestamp, int?nullableIncrement) { var subject = new BsonTimestampConverter(); var expectedResult = nullableTimestamp == null ? null : new BsonTimestamp(nullableTimestamp.Value, nullableIncrement.Value); var result = ReadJsonUsingWrappedJsonReader <BsonTimestamp>(subject, json); result.Should().Be(expectedResult); }
public void ReadJson_should_return_expected_result_when_using_native_json_reader(string json, int? nullableTimestamp, int? nullableIncrement) { var subject = new BsonTimestampConverter(); var expectedResult = nullableTimestamp == null ? null : new BsonTimestamp(nullableTimestamp.Value, nullableIncrement.Value); var result = ReadJsonUsingNativeJsonReader<BsonTimestamp>(subject, json); result.Should().Be(expectedResult); }
public void ReadJson_should_return_expected_result_when_using_native_bson_reader(string json, int?nullableTimestamp, int?nullableIncrement) { var subject = new BsonTimestampConverter(); var expectedResult = nullableTimestamp == null ? null : new BsonTimestamp(nullableTimestamp.Value, nullableIncrement.Value); var result = ReadJsonUsingNativeBsonReader <BsonTimestamp>(subject, ToBson(json), mustBeNested: true); result.Should().Be(expectedResult); }
public void WriteJson_should_have_expected_result_when_using_wrapped_json_writer(int?nullableTimestamp, int?nullableIncrement, string expectedResult) { var subject = new BsonTimestampConverter(); var value = nullableTimestamp == null ? null : new BsonTimestamp(nullableTimestamp.Value, nullableIncrement.Value); var result = WriteJsonUsingWrappedJsonWriter(subject, value); result.Should().Be(expectedResult); }
public void WriteJson_should_have_expected_result_when_using_native_bson_writer(int?nullableTimestamp, int?nullableIncrement, string expectedResult) { var subject = new BsonTimestampConverter(); var value = nullableTimestamp == null ? null : new BsonTimestamp(nullableTimestamp.Value, nullableIncrement.Value); var result = WriteJsonUsingNativeBsonWriter(subject, value, mustBeNested: true); result.Should().Equal(ToBson(expectedResult)); }
public void ReadJson_should_throw_when_token_type_is_invalid() { var subject = new BsonTimestampConverter(); var json = "undefined"; Action action = () => { var _ = ReadJsonUsingNativeJsonReader <BsonTimestamp>(subject, json); }; action.Should().Throw <Newtonsoft.Json.JsonReaderException>(); }
public void ReadJson_should_return_expected_result_when_using_wrapped_bson_reader(string json, int? nullableTimestamp, int? nullableIncrement) { var subject = new BsonTimestampConverter(); var expectedResult = nullableTimestamp == null ? null : new BsonTimestamp(nullableTimestamp.Value, nullableIncrement.Value); var result = ReadJsonUsingWrappedBsonReader<BsonTimestamp>(subject, ToBson(json), mustBeNested: true); result.Should().Be(expectedResult); }
public void WriteJson_should_have_expected_result_when_using_wrapped_json_writer(int? nullableTimestamp, int? nullableIncrement, string expectedResult) { var subject = new BsonTimestampConverter(); var value = nullableTimestamp == null ? null : new BsonTimestamp(nullableTimestamp.Value, nullableIncrement.Value); var result = WriteJsonUsingWrappedJsonWriter(subject, value); result.Should().Be(expectedResult); }
public void WriteJson_should_have_expected_result_when_using_native_bson_writer(int? nullableTimestamp, int? nullableIncrement, string expectedResult) { var subject = new BsonTimestampConverter(); var value = nullableTimestamp == null ? null : new BsonTimestamp(nullableTimestamp.Value, nullableIncrement.Value); var result = WriteJsonUsingNativeBsonWriter(subject, value, mustBeNested: true); result.Should().Equal(ToBson(expectedResult)); }
public void ReadJson_should_throw_when_token_type_is_invalid() { var subject = new BsonTimestampConverter(); var json = "undefined"; Action action = () => { var _ = ReadJsonUsingNativeJsonReader<BsonTimestamp>(subject, json); }; action.ShouldThrow<Newtonsoft.Json.JsonReaderException>(); }