public void Accountings_WhenCalled_ReturnsViewResultWhereViewNameIsEqualToAccountings()
        {
            Controller sut = CreateSut();

            ViewResult result = (ViewResult)sut.Accountings();

            Assert.That(result.ViewName, Is.EqualTo("Accountings"));
        }
        public void Accountings_WhenCalled_ReturnsViewResultWhereModelIsAccountingOptionsViewModel()
        {
            Controller sut = CreateSut();

            ViewResult result = (ViewResult)sut.Accountings();

            Assert.That(result.Model, Is.TypeOf <AccountingOptionsViewModel>());
        }
        public void Accountings_WhenCalled_ReturnsViewResult()
        {
            Controller sut = CreateSut();

            IActionResult result = sut.Accountings();

            Assert.That(result, Is.TypeOf <ViewResult>());
        }
        public void Accountings_WhenAccountingNumberIsNotNull_AssertGetAccountingNumberWasNotCalledOnClaimResolver()
        {
            Controller sut = CreateSut();

            sut.Accountings(_fixture.Create <int>());

            _claimResolverMock.Verify(m => m.GetAccountingNumber(), Times.Never);
        }
        public void Accountings_WhenAccountingNumberIsNull_AssertGetAccountingNumberWasCalledOnClaimResolver()
        {
            Controller sut = CreateSut();

            sut.Accountings();

            _claimResolverMock.Verify(m => m.GetAccountingNumber(), Times.Once);
        }
        public void Accountings_WhenAccountingNumberIsNullAndAccountingNumberWasNotReturnedFromClaimResolver_ReturnsViewResultWhereModelIsAccountingOptionsViewModelWhereDefaultAccountingNumberIsNull()
        {
            Controller sut = CreateSut(false);

            ViewResult result = (ViewResult)sut.Accountings();

            AccountingOptionsViewModel accountingOptionsViewModel = (AccountingOptionsViewModel)result.Model;

            Assert.That(accountingOptionsViewModel.DefaultAccountingNumber, Is.Null);
        }
        public void Accountings_WhenAccountingNumberIsNotNull_ReturnsViewResultWhereModelIsAccountingOptionsViewModelWhereDefaultAccountingNumberIsEqualToAccountingNumberArgument()
        {
            Controller sut = CreateSut();

            int        accountingNumber = _fixture.Create <int>();
            ViewResult result           = (ViewResult)sut.Accountings(accountingNumber);

            AccountingOptionsViewModel accountingOptionsViewModel = (AccountingOptionsViewModel)result.Model;

            Assert.That(accountingOptionsViewModel.DefaultAccountingNumber, Is.EqualTo(accountingNumber));
        }
        public void Accountings_WhenAccountingNumberIsNullAccountingNumberWasReturnedFromClaimResolver_ReturnsViewResultWhereModelIsAccountingOptionsViewModelWhereDefaultAccountingNumberIsEqualToAccountingNumberFromClaimResolver()
        {
            int        accountingNumber = _fixture.Create <int>();
            Controller sut = CreateSut(accountingNumber: accountingNumber);

            ViewResult result = (ViewResult)sut.Accountings();

            AccountingOptionsViewModel accountingOptionsViewModel = (AccountingOptionsViewModel)result.Model;

            Assert.That(accountingOptionsViewModel.DefaultAccountingNumber, Is.EqualTo(accountingNumber));
        }