public void AttachingDetachedEntitySucceeds() { // Arrange var svc = new Core.Core(_serviceRoot); var entity = new User(); Mock.Arrange(() => svc.AttachTo(Arg.AnyString, Arg.AnyObject)).OccursOnce(); // Act svc.AttachIfNeeded(entity); // Assert Mock.Assert(svc); }
public void AttachingEntityToInvalidEntitySetThrowsException() { // Arrange var svc = new Core.Core(_serviceRoot); var entity = new User(); var entitySetName = "InvalidEntitySetName"; Mock.Arrange(() => svc.AttachTo(Arg.AnyString, Arg.AnyObject)).OccursOnce(); // Act svc.AttachIfNeeded(entitySetName, entity); // Assert Mock.Assert(svc); }