public void AssociateOriginal_ChangeSet_GetOriginal() { var proxy = DomainServiceProxy.Create <IMockDomainServiceContract, MockDomainService>(new MockDomainServiceContext(DomainOperationType.Submit)); Assert.IsNull(this.OperationInvokedArgs); var entity = proxy.GetSingletonEntity(); entity.Name = "CurrentEntity"; Assert.AreEqual("CurrentEntity", entity.Name); var original = new MockEntity() { ID = entity.ID, Name = "OriginalEntity" }; DomainServiceProxy.AssociateOriginal(proxy, entity, original); proxy.UpdateEntity(entity); Assert.IsNotNull(this.OperationInvokedArgs); Assert.AreEqual("UpdateEntity", this.OperationInvokedArgs.Name); Assert.AreEqual(1, this.OperationInvokedArgs.Parameters.Count); Assert.AreSame(entity, this.OperationInvokedArgs.Parameters.Values.Single()); Assert.AreEqual("OriginalEntity", entity.Name); }
public void AssociateOriginal_HelperMethod_InvalidProxy() { ExceptionHelper.ExpectArgumentException( () => DomainServiceProxy.AssociateOriginal <object>(new object(), new object(), new object()), Resource.DomainServiceProxy_InvalidProxyType, "domainServiceProxy"); }
public void AssociateOriginal_HelperMethod() { var proxy = this.CreateMockDomainServiceProxy(); var current = new object(); var original = new object(); DomainServiceProxy.AssociateOriginal <object>(proxy, current, original); Assert.AreEqual(1, proxy.CurrentOriginalEntityMap.Count); Assert.AreSame(current, proxy.CurrentOriginalEntityMap.Keys.Single()); Assert.AreSame(original, proxy.CurrentOriginalEntityMap.Values.Single()); }
public void AssociateOriginal_HelperMethod_NullParameters() { // Null proxy argument ExceptionHelper.ExpectArgumentNullException( () => DomainServiceProxy.AssociateOriginal <object>(null, new object(), new object()), "domainServiceProxy"); // Null current argument ExceptionHelper.ExpectArgumentNullException( () => DomainServiceProxy.AssociateOriginal <object>(new object(), null, new object()), "current"); // Null original argument ExceptionHelper.ExpectArgumentNullException( () => DomainServiceProxy.AssociateOriginal <object>(new object(), new object(), null), "original"); }