public void InitializeErroLabel() { var categoryPropertyPresenter = new CategoryPropertyPresenter(m_MockCategoryProperty); categoryPropertyPresenter.InitErrorLabel(); Assert.IsFalse(m_MockCategoryProperty.ErrorLabel.Visible); Assert.AreEqual(string.Empty, m_MockCategoryProperty.ErrorLabel.Text); }
public void Test_SetButtonsToEditMode() { var categoryPropertyService = new CategoryPropertyPresenter(m_MockCategoryProperty); categoryPropertyService.SetButtonToEditMode(); Assert.IsFalse(m_MockCategoryProperty.NewCategory.Visible); Assert.IsFalse(m_MockCategoryProperty.NewSerie.Visible); Assert.IsTrue(m_MockCategoryProperty.Update.Visible); Assert.IsFalse(m_MockCategoryProperty.Delete.Visible); Assert.IsTrue(m_MockCategoryProperty.Cancel.Visible); }
public void Test_Delete_IfCategoryIsNull() { m_MockCategoryProperty.Category = null; ICategoryService categoryService = ObjectFactory.GetInstance<ICategoryService>(); var categories = categoryService.GetAll(); CategoryPropertyPresenter categoryPropertyPresenter = new CategoryPropertyPresenter(m_MockCategoryProperty); categoryPropertyPresenter.Delete(m_MockCategoryProperty.Category); Assert.AreEqual(categories.Count, categoryService.GetAll().Count); }
public void Test_Update_IfNameIsValid() { m_MockCategoryProperty.Category = new Category{ Id = 0, Name = "test", Description = "desc"}; CategoryPropertyPresenter categoryPropertyPresenter = new CategoryPropertyPresenter(m_MockCategoryProperty); categoryPropertyPresenter.SetFields(); Assert.IsTrue(categoryPropertyPresenter.Update(m_MockCategoryProperty.Category)); Assert.IsFalse(m_MockCategoryProperty.ErrorLabel.Visible); Assert.AreEqual(string.Empty, m_MockCategoryProperty.ErrorLabel.Text); //Revert saving ICategoryService categoryService = ObjectFactory.GetInstance<ICategoryService>(); var categories = categoryService.GetAll(); categoryService.DeleteById(categories[categories.Count - 1].Id); }
public void Test_SetFields_CategoryIsNull() { m_MockCategoryProperty.Category = null; var categoryPropertyPresenter = new CategoryPropertyPresenter(m_MockCategoryProperty); categoryPropertyPresenter.SetFields(); Assert.AreEqual(string.Empty, m_MockCategoryProperty.NameTextBox.Text); Assert.AreEqual(string.Empty, m_MockCategoryProperty.DescriptionTextBox.Text); }
public void Test_Update_IfNameIsNotValid() { m_MockCategoryProperty.Category = new Category{ Id = 0, Name = string.Empty, Description = "desc"}; var categoryPropertyPresenter = new CategoryPropertyPresenter(m_MockCategoryProperty); categoryPropertyPresenter.SetFields(); Assert.IsFalse(categoryPropertyPresenter.Update(m_MockCategoryProperty.Category)); Assert.IsTrue(m_MockCategoryProperty.ErrorLabel.Visible); Assert.AreEqual("Bitte geben Sie der Kategorie einen Namen!", m_MockCategoryProperty.ErrorLabel.Text); }
public void Test_SetFields_CategoryIsNotNull() { var categoryPropertyPresenter = new CategoryPropertyPresenter(m_MockCategoryProperty); m_MockCategoryProperty.Category = new Category { Id = 0, Name = "Test", Description = "Desc"}; categoryPropertyPresenter.SetFields(); Assert.AreEqual("Test", m_MockCategoryProperty.NameTextBox.Text); Assert.AreEqual("Desc", m_MockCategoryProperty.DescriptionTextBox.Text); }
protected override void Context() { m_CategoryPropertyPresenter = new CategoryPropertyPresenter(MockCategoryProperty); }
protected override void Context() { MockCategoryProperty.Category = new Category { Id = 1 }; m_CategoryPropertyPresenter = new CategoryPropertyPresenter(MockCategoryProperty); }
protected override void Context() { MockCategoryProperty.Category = new Category { Id = 1, Name = "test", Description = "desc" }; m_CategoryPropertyPresenter = new CategoryPropertyPresenter(MockCategoryProperty); m_CategoryPropertyPresenter.SetFields(); }
protected override void Context() { MockCategoryProperty.Category = new Category { Id = 0, Name = "Test", Description = "Desc"}; m_CategoryPropertyPresenter = new CategoryPropertyPresenter(MockCategoryProperty); }