Beispiel #1
0
        public async Task DeleteTransactionTypeAsync_Successfully_Deleted()
        {
            //Arrange
            var id      = 1;
            var service = new TransactionTypeService(_myRestaurantContext);

            //Act
            var dbTransactionType = await service.GetTransactionTypeAsync(d => d.Id == id);

            await service.DeleteTransactionTypeAsync(dbTransactionType !);

            var result = await service.GetTransactionTypeAsync(d => d.Id == id);

            //Assert
            result.Should().BeNull();
        }
Beispiel #2
0
        public async Task UpdateTransactionTypeAsync_Successfully_Updated()
        {
            //Arrange
            var id      = 4;
            var service = new TransactionTypeService(_myRestaurantContext);

            //Act
            var dbTransactionType = await service.GetTransactionTypeAsync(d => d.Id == id);

            dbTransactionType !.Type = "Mortgage/Rent";

            await service.UpdateTransactionTypeAsync(dbTransactionType);

            var result = await service.GetTransactionTypeAsync(d => d.Id == id);

            //Assert
            result.Should().BeAssignableTo <TransactionType>();
            result !.Id.Should().Be(id);
            result.Type.Should().Be("Mortgage/Rent");
        }
Beispiel #3
0
        public async Task GetTransactionTypeAsync_Returns_Null()
        {
            //Arrange
            var id      = 1001;
            var service = new TransactionTypeService(_myRestaurantContext);

            //Act
            var result = await service.GetTransactionTypeAsync(d => d.Id == id);

            //Assert
            result.Should().BeNull();
        }
Beispiel #4
0
        public async Task GetTransactionTypeAsync_Returns_TransactionType()
        {
            //Arrange
            var id      = 1;
            var service = new TransactionTypeService(_myRestaurantContext);

            //Act
            var result = await service.GetTransactionTypeAsync(d => d.Id == id);

            //Assert
            result.Should().BeAssignableTo <TransactionType>();
            result !.Id.Should().Be(id);
            result.Type.Should().Be("Food");
        }