public void ShouldGetFieldDtoById() { //Arrange var domainService = new Mock <IConversationFieldService>(); domainService.Setup(t => t.Find(1)).Returns(MakeConversationEntity(1)); ConversationFieldAppService conversationFieldAppService = new ConversationFieldAppService(domainService.Object); //Act ConversationFieldDto conversationDto = conversationFieldAppService.Find(1); //Assert Assert.NotNull(conversationDto); AssertDtoEqualToEntity(MakeConversationEntity(1), conversationDto); }
public void ShouldGetAllFieldDtos() { //Arrange var conversationFields = new List <ConversationField> { MakeConversationEntity(1), MakeConversationEntity(2), }; var domainService = new Mock <IConversationFieldService>(); domainService.Setup(t => t.FindAllAndFillOptions()).Returns(conversationFields); ConversationFieldAppService conversationFieldAppService = new ConversationFieldAppService(domainService.Object); //Act List <ConversationFieldDto> conversationDtos = conversationFieldAppService.FindAll(); //Assert Assert.True(conversationDtos.Any()); AssertDtoEqualToEntity(conversationFields.First(t => t.Id == 1), conversationDtos[0]); AssertDtoEqualToEntity(conversationFields.First(t => t.Id == 2), conversationDtos[1]); }