コード例 #1
0
        public void ApplyTo_InvokedWithInvalidJson_ShouldThrowArgumentException()
        {
            // Arrange
            var invalidJson = "{\"test\":{not valid format}}";

            // Act

            // Assert
            Assert.Throws <ArgumentException>(() => _patcharpService.ApplyPatchOperation(new Entity(), invalidJson));
        }
コード例 #2
0
        public void GivenShortEdgeValues_WhenTryingToPatchInt_ThenConvertsSuccessfully(T value)
        {
            // Arrange
            Assume.That(value is short);
            var json   = $"{{\"ValueInt\":\"{value}\"}}";
            var entity = new Entity();

            // Act
            _patcharp.ApplyPatchOperation(entity, json);

            // Assert
            Assert.That(value, Is.EqualTo(entity.ValueInt));
        }