public async Task IfRecipientExistsAsyncShouldReturnTrue() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var ifExists = await recipientService.IfRecipientExistsAsync("0000 000 000"); Assert.True(ifExists); }
public async Task CreateRecipientAsyncShouldReturnId() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var expected = 1; var actual = returnId; Assert.Equal(expected, actual); }
public async Task DeleteRecipientAsyncShouldReturnTrue() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var isDeleted = await recipientService.DeleteRecipientAsync(new RecipientDeleteDtoModel { RecipientId = 1 }); Assert.True(isDeleted); }
public async Task GetRecipientParamsForUpdateAsyncShouldReturnFirstName() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var recipient = await recipientService.GetRecipientParamsForUpdateAsync(new RecipientUpdateOutputDtoModel { RecipientId = 1 }); var expected = "Test"; var actual = recipient.FirstName; Assert.Equal(expected, actual); }
public async Task UpdateRecipientAsyncShouldReturnTrue() { var orderService = GetOrderService.Return(db); var recipientRepository = new Repository <Recipient>(db); var recipientService = new RecipientService(recipientRepository, orderService); var returnId = await recipientService.CreateRecipientAsync("Test", "Testov", "TestTown", "Test12", "0000 000 000"); var isUpdated = await recipientService.UpdateRecipientAsync(new RecipientUpdateInputDtoModel { RecipientId = 1, FirstName = "Test1", LastName = "Testov", RecipientTown = "TestTown", Address = "Test12", Phone = "0000 000 000" }); Assert.True(isUpdated); }