public void ThrowException_WhenTheArgumentsAreWithDifferentLength() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock(), new PersonDomainEntityMock() }; PersonDataEntityMock[] dataEntities = new PersonDataEntityMock[] { new PersonDataEntityMock(), new PersonDataEntityMock(), new PersonDataEntityMock(), new PersonDataEntityMock() }; // Act & Assert. Ensure.ArgumentExceptionIsThrown(() => { this.EntityMapperBaseMock.CopyPropertiesToDataEntities(domainEntities, dataEntities); }, "fromDomainEntities.Length"); }
public void CallCopyPropertiesToDataEntityOverride_WhenArgumentsAreValid() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock(), new PersonDomainEntityMock(), new PersonDomainEntityMock(), new PersonDomainEntityMock() }; PersonDataEntityMock[] dataEntities = new PersonDataEntityMock[] { new PersonDataEntityMock(), new PersonDataEntityMock(), new PersonDataEntityMock(), new PersonDataEntityMock() }; // Act. this.EntityMapperBaseMock.CopyPropertiesToDataEntities(domainEntities, dataEntities); // Assert. this.EntityMapperBaseMock.AssertCopyPropertiesToDataEntityOverrideCalls( TupleHelper.CombineIntoTupleArray(domainEntities, dataEntities)); }
public void ReturnTheSameDomainEntity_WhenEntityArgumentIsValid() { // Arrange. PersonDomainEntityMock domainEntity = new PersonDomainEntityMock(); // Act. PersonDomainEntityMock result = this.DomainRepository.Insert(domainEntity); // Assert. Assert.AreSame(domainEntity, result); }
public void RunInExpectedTime() { // Act & Assert. Ensure.ActionRunsInExpectedTime( () => { PersonDomainEntityMock domainEntity = new PersonDomainEntityMock(); this.DomainRepository.Insert(domainEntity); }, ExecutionTimeType.Normal); }
public void CallCopyPropertiesToDomainEntityOverride_WhenArgumentsAreValid() { // Arrange. PersonDataEntityMock dataEntity = new PersonDataEntityMock(); PersonDomainEntityMock domainEntity = new PersonDomainEntityMock(); // Act. this.EntityMapperBaseMock.CopyPropertiesToDomainEntity(dataEntity, domainEntity); // Assert. this.EntityMapperBaseMock.AssertCopyPropertiesToDomainEntityOverrideCalls(new Tuple<PersonDataEntityMock, PersonDomainEntityMock>(dataEntity, domainEntity)); }
public void CallDataRepositoryDeleteMethod_WhenEntityArgumentIsValid() { // Arrange. PersonDomainEntityMock domainEntity = new PersonDomainEntityMock() { Id = 3 }; // Act. this.DomainRepository.Delete(domainEntity); // Assert. PersonDataEntityMock dataEntity = this.UnitOfWorkMock.RegisterRemovedCalls.Single(); this.DataRepositoryMock.AssertDeleteWithEntityCalls(dataEntity.Id); }
public void CallDataRepositoryInsertMethod_WhenEntityArgumentIsValid() { // Arrange. PersonDomainEntityMock domainEntity = new PersonDomainEntityMock(); // Act. this.DomainRepository.Insert(domainEntity); // Assert. PersonDataEntityMock dataEntity = this.UnitOfWorkMock.RegisterNewCalls.Single(); this.DataRepositoryMock.AssertInsertCalls(dataEntity); }
public void CallDataRepositoryUpdateMethod_WhenEntityArgumentIsValid() { // Arrange. PersonDomainEntityMock domainEntity = new PersonDomainEntityMock() { Id = 5 }; // Act. this.DomainRepository.Update(domainEntity); // Assert. PersonDataEntityMock dataEntity = this.UnitOfWorkMock.RegisterDirtyCalls.Single(); this.DataRepositoryMock.AssertUpdateCalls(dataEntity); }
public void CallEntityMappertCopyPropertiesToDomainEntityMethod_WhenEntityArgumentIsValid() { // Arrange. PersonDomainEntityMock domainEntity = new PersonDomainEntityMock(); // Act. this.DomainRepository.Insert(domainEntity); // Assert. PersonDataEntityMock dataEntity = this.UnitOfWorkMock.RegisterNewCalls.Single(); this.EntityMapperMock.AssertCopyPropertiesToDomainEntityOverrideCalls( new Tuple<PersonDataEntityMock, PersonDomainEntityMock>(dataEntity, domainEntity)); }
public void RunInExpectedTime() { // Arrange. PersonDomainEntityMock domainEntity = new PersonDomainEntityMock() { Id = 3 }; // Act & Assert. Ensure.ActionRunsInExpectedTime( () => { this.DomainRepository.Delete(domainEntity); }, ExecutionTimeType.Normal); }
public void RunInExpectedTime() { // Arrange. PersonDataEntityMock dataEntity = new PersonDataEntityMock(); PersonDomainEntityMock domainEntity = new PersonDomainEntityMock(); // Act & Assert. Ensure.ActionRunsInExpectedTime( () => { this.EntityMapperBaseMock.CopyPropertiesToDomainEntity(dataEntity, domainEntity); }, ExecutionTimeType.Fast); }
public void ThrowArgumentNullException_WhenEntitiesArgumentContainsNull() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock() { Id = 1 }, null, new PersonDomainEntityMock() { Id = 1 } }; // Act & Assert. Ensure.ArgumentNullExceptionIsThrown(() => { this.DomainRepository.DeleteAll(domainEntities); }, "entity"); }
public void CallDataRepositoryInsertAllMethod_WhenEntitiesArgumentIsValid() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock(), new PersonDomainEntityMock(), new PersonDomainEntityMock() }; // Act. this.DomainRepository.InsertAll(domainEntities); // Assert. PersonDataEntityMock[] dataEntities = this.UnitOfWorkMock.RegisterNewCalls.ToArray(); this.DataRepositoryMock.AssertInsertAllCalls(dataEntities); }
public void CallDataRepositoryDeleteAllMethod_WhenEntitiesArgumentIsValid() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock() { Id = 1 }, new PersonDomainEntityMock() { Id = 1 }, new PersonDomainEntityMock() { Id = 1 } }; // Act. this.DomainRepository.DeleteAll(domainEntities); // Assert. PersonDataEntityMock[] dataEntities = this.UnitOfWorkMock.RegisterRemovedCalls.ToArray(); this.DataRepositoryMock.AssertDeleteAllCalls(dataEntities); }
public void CallEntityMapperToDataEntityMethodForEachEntity_WhenEntitiesArgumentIsValid() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock() { Id = 1 }, new PersonDomainEntityMock() { Id = 1 }, new PersonDomainEntityMock() { Id = 1 } }; // Act. this.DomainRepository.DeleteAll(domainEntities); // Assert. PersonDataEntityMock[] dataEntities = this.UnitOfWorkMock.RegisterRemovedCalls.ToArray(); this.EntityMapperMock.AssertCopyPropertiesToDataEntityOverrideCalls( TupleHelper.CombineIntoTupleArray(domainEntities, dataEntities)); }
public void RunInExpectedTime() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock() { Id = 1 }, new PersonDomainEntityMock() { Id = 1 }, new PersonDomainEntityMock() { Id = 1 } }; // Act & Assert. Ensure.ActionRunsInExpectedTime( () => { this.DomainRepository.UpdateAll(domainEntities); }, ExecutionTimeType.Normal); }
public void RunInExpectedTime() { // Act & Assert. Ensure.ActionRunsInExpectedTime( () => { PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock(), new PersonDomainEntityMock(), new PersonDomainEntityMock() }; this.DomainRepository.SaveAll(domainEntities); }, ExecutionTimeType.Normal); }
public void RunInExpectedTime() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock(), new PersonDomainEntityMock(), new PersonDomainEntityMock(), new PersonDomainEntityMock() }; PersonDataEntityMock[] dataEntities = new PersonDataEntityMock[] { new PersonDataEntityMock(), new PersonDataEntityMock(), new PersonDataEntityMock(), new PersonDataEntityMock() }; // Act & Assert. Ensure.ActionRunsInExpectedTime( () => { this.EntityMapperBaseMock.CopyPropertiesToDataEntities(domainEntities, dataEntities); }, ExecutionTimeType.Normal); }
public void ReturnTheSameDomainEntities_WhenEntitiesArgumentIsValid() { // Arrange. PersonDomainEntityMock[] domainEntities = new PersonDomainEntityMock[] { new PersonDomainEntityMock() { Id = 1 }, new PersonDomainEntityMock() { Id = 1 }, new PersonDomainEntityMock() { Id = 1 } }; // Act. PersonDomainEntityMock[] result = this.DomainRepository.UpdateAll(domainEntities); // Assert. CollectionAssert.AreEqual(domainEntities, result); }