public void ShouldReturnMethodInstanceFromFailoverCustomerDataAccessForDoFailover()
        {
            var customerResponseForDoFailover = new CustomerResponse() { Customer = new Customer() { Id = 10, Name = "CustomerNameForDoFailover" } };
            var customerResponseForDontFailover = new CustomerResponse() { Customer = new Customer() { Id = 20, Name = "CustomerNameForDontFailover" } };

            _mockedFailoverCustomerDataAccess.Setup(x => x.GetCustomerById(It.IsAny<int>())).Returns(customerResponseForDoFailover);
            _mockedCustomerDataAccess.Setup(x => x.LoadCustomer(It.IsAny<int>())).Returns(customerResponseForDontFailover);

            var delegateObj = _sut.GetDataAccessResponseByFailoverState(FailoverState.DoFailover);
            var returnValue = delegateObj.Invoke(1);

            Assert.AreEqual(customerResponseForDoFailover,returnValue);
        }
        public void ShouldCallArchiveDataServiceWhenItGetsArchivedCustomerBack()
        {
            var expectedCustomerResponse = new CustomerResponse
            {
                Customer = new Customer() {Id = 1, Name = "abc"},
                IsArchived = true
            };

            _mockedCustomerDataService.Setup((x => x.GetCustomerResponse(It.IsAny<int>())))
                .Returns(expectedCustomerResponse);

            _mockedArchivedDataService.Setup((x => x.GetArchivedCustomer(It.IsAny<int>()))).Verifiable();

            _sut.GetCustomer(10);

            _mockedArchivedDataService.Verify(x => x.GetArchivedCustomer(It.IsAny<int>()), Times.Once);
            //_mockedArchivedDataService.VerifyAll();
        }
        public void ShouldReturnSameNotArchivedCustomerThatCustomerDataServiceReturns()
        {
            var expectedCustomerResponse = new CustomerResponse
            {
                Customer = new Customer() {Id = 1, Name = "abc"},
                IsArchived = false
            };

            _mockedCustomerDataService.Setup((x => x.GetCustomerResponse(It.IsAny<int>())))
                .Returns(expectedCustomerResponse);

            var actualCustomer = _sut.GetCustomer(1);

            Assert.IsNotNull(actualCustomer);
            Assert.AreEqual(expectedCustomerResponse.Customer, actualCustomer);
        }
        public void ShouldPassTheCorrectCustomerIdToCustomerDataService()
        {
            var expectedCustomerResponse = new CustomerResponse
            {
                Customer = new Customer() {Id = 1, Name = "abc"},
                IsArchived = false
            };

            int customerIdFromRequest=0;

            _mockedCustomerDataService
                .Setup((x => x.GetCustomerResponse(It.IsAny<int>())))
                .Callback((int cId) => customerIdFromRequest = cId)
                .Returns(expectedCustomerResponse);

            _sut.GetCustomer(10);

            Assert.AreEqual(10, customerIdFromRequest);
        }
        public void ShouldCallCustomerDataService()
        {
            var expectedCustomerResponse = new CustomerResponse
            {
                Customer = new Customer() {Id = 1, Name = "abc"},
                IsArchived = false
            };

            _mockedCustomerDataService.Setup((x => x.GetCustomerResponse(It.IsAny<int>())))
                .Returns(expectedCustomerResponse)
                .Verifiable();

            _sut.GetCustomer(10);

            _mockedCustomerDataService.Verify(x => x.GetCustomerResponse(It.IsAny<int>()), Times.Once);
        }
        public void ShouldCallArchiveDataServiceWithCorrectCustomerIdWhenItGetsArchivedCustomerBack()
        {
            var expectedCustomerResponse = new CustomerResponse
            {
                Customer = new Customer() {Id = 1, Name = "abc"},
                IsArchived = true
            };

            int customerIdFromRequest=0;

            _mockedCustomerDataService.Setup((x => x.GetCustomerResponse(It.IsAny<int>())))
                .Returns(expectedCustomerResponse);

            _mockedArchivedDataService.Setup((x => x.GetArchivedCustomer(It.IsAny<int>()))).Verifiable();

            _mockedArchivedDataService
                .Setup((x => x.GetArchivedCustomer(It.IsAny<int>())))
                .Callback((int cId) => customerIdFromRequest = cId);

            _sut.GetCustomer(10);

            Assert.AreEqual(10, customerIdFromRequest);
        }