public InventoryEventTypeDto WriteDto(InventoryEventType inventoryEventType) { if (inventoryEventType == null) throw new ArgumentNullException(); var invEventTypeDto = new InventoryEventTypeDto(); invEventTypeDto.EventType = inventoryEventType.EventType; return invEventTypeDto; }
public InventoryEventType ReadDto(InventoryEventTypeDto inventoryEventTypeDto) { if (inventoryEventTypeDto == null) throw new ArgumentNullException(); var inventoryEventType = ObjectFactory.GetInstance<IInventoryEventTypeRepository>().FindByEventName(inventoryEventTypeDto.EventType); return inventoryEventType == null ? new InventoryEventType() { EventType = inventoryEventTypeDto.EventType } : inventoryEventType; }
public void AssemblerCorrectlyReadsInventoryEventTypeParticipationDto() { var invEventTypeDto = new InventoryEventTypeDto(); //eventAreaDto.Id = 9876; invEventTypeDto.EventType = Constants.InventoryEventTypes.RECEIPT_FROM_VENDOR; var mockInvEventTypeRepository = new Mock<IInventoryEventTypeRepository>(); mockInvEventTypeRepository.Setup(x => x.FindByEventName(invEventTypeDto.EventType)).Returns(new InventoryEventType() { EventType = invEventTypeDto.EventType }); ObjectFactory.Inject(typeof(IInventoryEventTypeRepository), mockInvEventTypeRepository.Object); var invEventType = _assembler.ReadDto(invEventTypeDto); Assert.IsNotNull(invEventType); Assert.AreEqual(invEventTypeDto.EventType, invEventType.EventType); mockInvEventTypeRepository.VerifyAll(); }