Example #1
0
        public void GetTransactionCategorySelectList_WhenSuccess_ReturnSelectList_Test()
        {
            // Arrange
            //var sut = _service;
            string expSelectedId = null;

            // Act
            var result = _service.GetTransactionCategorySelectList(expSelectedId);

            // Assert
            Assert.IsInstanceOf(typeof(List <SelectListItem>), result, "Result Type");
            Assert.IsNotNull(result, "Result");
            Assert.AreNotEqual(0, result.Count, "Result Count");
        }
Example #2
0
        public void GetTransactionCategorySelectList_WhenSuccess_ReturnOrderedByTransactionTypeName_Test()
        {
            // Arrange
            var _dataTransactionCategories = new List <Core.Models.TransactionCategory>()
            {
                new Core.Models.TransactionCategory()
                {
                    Id = 10, Name = "Z", IsActive = true
                },
                new Core.Models.TransactionCategory()
                {
                    Id = 11, Name = "A", IsActive = true
                },
                new Core.Models.TransactionCategory()
                {
                    Id = 12, Name = "B", IsActive = true
                },
            };

            _unitOfWork.TransactionCategories = new InMemoryTransactionCategoryRepository(_dataTransactionCategories);
            _service = new AccountTransactionService(_unitOfWork);
            string expSelectedId = "99";

            // Act
            var result = _service.GetTransactionCategorySelectList(expSelectedId);

            // Assert
            Assert.IsInstanceOf(typeof(List <SelectListItem>), result, "Result Type");
            Assert.AreEqual("A", result[0].Text, "Result Name A");
            Assert.AreEqual("B", result[1].Text, "Result Name B");
            Assert.AreEqual("Z", result[2].Text, "Result Name Z");
        }
Example #3
0
        public void GetTransactionCategorySelectList_WhenSuccess_ReturnActiveTransactionTypes_Test()
        {
            // Arrange
            var _dataTransactionCategories = new List <Core.Models.TransactionCategory>()
            {
                new Core.Models.TransactionCategory()
                {
                    Id = 10, Name = "Active", IsActive = true
                },
                new Core.Models.TransactionCategory()
                {
                    Id = 11, Name = "Not Active", IsActive = false
                },
            };

            _unitOfWork.TransactionCategories = new InMemoryTransactionCategoryRepository(_dataTransactionCategories);
            _service = new AccountTransactionService(_unitOfWork);
            string expSelectedId = null;

            // Act
            var result = _service.GetTransactionCategorySelectList(expSelectedId);

            // Assert
            Assert.IsInstanceOf(typeof(List <SelectListItem>), result, "Result Type");
            Assert.AreEqual(1, result.Count, "Result Count");
        }
Example #4
0
        public void GetTransactionCategorySelectList_WhenCalled_ReturnSelectListItems_Test()
        {
            var result = _service.GetTransactionCategorySelectList(selectedId: null);

            Assert.That(result, Is.InstanceOf <List <SelectListItem> >());
        }