コード例 #1
0
        public void GetCustomersLookup_ReturnsException_WithInternalExceptionOccures()
        {
            //Arrange
            _mockCustomersRepo.Setup(rep => rep.All()).Throws <Exception>();
            _mockRepositoryProvider.Setup(rep => rep.GetRepositoryForEntityType <Customer>()).Returns(_mockCustomersRepo.Object);
            _vehicleServiceUow = new VehicleServiceUOW(_mockRepositoryProvider.Object, _mockLogger);

            // Act
            _vehicleServiceUow.GetCustomersLookup();
        }
コード例 #2
0
        public void GetCustomersLookup_ReturnsListOfLookupDTOs_WithAnyRequest()
        {
            // Arrange
            _mockCustomersRepo.Setup(rep => rep.All()).Returns(_customers.AsQueryable());
            _mockRepositoryProvider.Setup(rep => rep.GetRepositoryForEntityType <Customer>()).Returns(_mockCustomersRepo.Object);
            _vehicleServiceUow = new VehicleServiceUOW(_mockRepositoryProvider.Object, _mockLogger);

            // Act
            var result = _vehicleServiceUow.GetCustomersLookup();

            // Assert
            Assert.IsInstanceOfType(result, typeof(IEnumerable <LookupDTO>));
            Assert.AreEqual(3, result.Count);
        }