예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }