public void FromObject_NullTarget_ThrowException() { var exception = Assert.Throws <ArgumentNullException>(() => SetFields.FromObject(null, null)); exception.ShouldBeOfType <ArgumentNullException>(); exception.ShouldNotBeNull(); exception.ParamName.ShouldBe("target"); }
public void FromObject_NotNullSourceAndTargetWithExtraProperty_Success() { var target = new Demo(); var id = Guid.Parse("{6E25FEB7-771E-4194-BAA2-4184F54C4953}"); var source = new { Id = id, Name = "Alper", Code = 1 }; SetFields.FromObject(target, source); target.Id.ShouldBe(id); target.Name.ShouldBe("Alper"); }
public void FromObject_NullSource_DoNothing() { SetFields.FromObject(GetType(), null); }