public void CreateBudgetAccountGroup_WhenCalledWithoutModel_ReturnsViewResult() { Controller sut = CreateSut(); IActionResult result = sut.CreateBudgetAccountGroup(); Assert.That(result, Is.TypeOf <ViewResult>()); }
public void CreateBudgetAccountGroup_WhenCalledWithoutModel_ReturnsViewResultWhereViewNameIsEqualToCreateBudgetAccountGroup() { Controller sut = CreateSut(); ViewResult result = (ViewResult)sut.CreateBudgetAccountGroup(); Assert.That(result.ViewName, Is.EqualTo("CreateBudgetAccountGroup")); }
public async Task CreateBudgetAccountGroup_WhenCalledWithInvalidModel_AssertPublishAsyncWasNotCalledOnCommandBus() { Controller sut = CreateSut(false); BudgetAccountGroupViewModel model = CreateModel(); await sut.CreateBudgetAccountGroup(model); _commandBusMock.Verify(m => m.PublishAsync(It.IsAny <ICreateBudgetAccountGroupCommand>()), Times.Never); }
public async Task CreateBudgetAccountGroup_WhenCalledWithValidModel_ReturnsRedirectToActionResultWhereActionNameIsEqualToBudgetAccountGroups() { Controller sut = CreateSut(); BudgetAccountGroupViewModel model = CreateModel(); RedirectToActionResult result = (RedirectToActionResult)await sut.CreateBudgetAccountGroup(model); Assert.That(result.ActionName, Is.EqualTo("BudgetAccountGroups")); }
public async Task CreateBudgetAccountGroup_WhenCalledWithValidModel_ReturnsRedirectToActionResult() { Controller sut = CreateSut(); BudgetAccountGroupViewModel model = CreateModel(); IActionResult result = await sut.CreateBudgetAccountGroup(model); Assert.That(result, Is.TypeOf <RedirectToActionResult>()); }
public async Task CreateBudgetAccountGroup_WhenCalledWithValidModel_AssertPublishAsyncWasCalledOnCommandBus() { Controller sut = CreateSut(); BudgetAccountGroupViewModel model = CreateModel(); await sut.CreateBudgetAccountGroup(model); _commandBusMock.Verify(m => m.PublishAsync(It.Is <ICreateBudgetAccountGroupCommand>(command => command.Number == model.Number && string.CompareOrdinal(command.Name, model.Name) == 0)), Times.Once); }
public async Task CreateBudgetAccountGroup_WhenCalledWithInvalidModel_ReturnsViewResultWhereViewNameIsEqualToCreateBudgetAccountGroup() { Controller sut = CreateSut(false); BudgetAccountGroupViewModel model = CreateModel(); ViewResult result = (ViewResult)await sut.CreateBudgetAccountGroup(model); Assert.That(result.ViewName, Is.EqualTo("CreateBudgetAccountGroup")); }
public async Task CreateBudgetAccountGroup_WhenCalledWithInvalidModel_ReturnsViewResultWhereModelIsEqualToInvalidModel() { Controller sut = CreateSut(false); BudgetAccountGroupViewModel model = CreateModel(); ViewResult result = (ViewResult)await sut.CreateBudgetAccountGroup(model); Assert.That(result.Model, Is.TypeOf <BudgetAccountGroupViewModel>()); BudgetAccountGroupViewModel budgetAccountGroupViewModel = (BudgetAccountGroupViewModel)result.Model; Assert.That(budgetAccountGroupViewModel, Is.EqualTo(model)); }
public void CreateBudgetAccountGroup_WhenCalledWithoutModel_ReturnsViewResultWhereModelIsBudgetAccountGroupViewModel() { Controller sut = CreateSut(); ViewResult result = (ViewResult)sut.CreateBudgetAccountGroup(); Assert.That(result.Model, Is.TypeOf <BudgetAccountGroupViewModel>()); BudgetAccountGroupViewModel budgetAccountGroupViewModel = (BudgetAccountGroupViewModel)result.Model; Assert.That(budgetAccountGroupViewModel, Is.Not.Null); Assert.That(budgetAccountGroupViewModel.Number, Is.EqualTo(default(int))); Assert.That(budgetAccountGroupViewModel.Name, Is.Null); Assert.That(budgetAccountGroupViewModel.EditMode, Is.EqualTo(EditMode.Create)); }
public void CreateBudgetAccountGroup_WhenCalledWithModelWhereModelIsNull_ThrowsArgumentNullException() { Controller sut = CreateSut(); ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.CreateBudgetAccountGroup(null)); Assert.That(result.ParamName, Is.EqualTo("budgetAccountGroupViewModel")); }