public void Test_Update_IfPriceIsNotValid() { m_MockFigurProperty.Figur = new Figur{ Id = 0, Name = "test", Description = "desc", Price = (decimal)-10.11, Serie = new Serie { Id = 1 }}; FigurPropertyPresenter figurPropertyService = new FigurPropertyPresenter(m_MockFigurProperty); figurPropertyService.SetFields(); Assert.IsFalse(figurPropertyService.Update(m_MockFigurProperty.Figur)); Assert.IsTrue(m_MockFigurProperty.ErrorMessage.Visible); string expected = "Bitte geben Sie einen gültigen Preis ein!" + Environment.NewLine; Assert.AreEqual(expected, m_MockFigurProperty.ErrorMessage.Text); }
public void Test_SetFields_FigurIsNull() { FigurPropertyPresenter figurPropertyPresenter = new FigurPropertyPresenter(m_MockFigurProperty); m_MockFigurProperty.Figur = null; figurPropertyPresenter.SetFields(); Assert.AreEqual(string.Empty, m_MockFigurProperty.Name.Text); Assert.AreEqual(string.Empty, m_MockFigurProperty.Description.Text); Assert.AreEqual(string.Empty, m_MockFigurProperty.Price.Text); ISerieService serieService = ObjectFactory.GetInstance<ISerieService>(); var serie = serieService.GetById(1); Assert.AreEqual(serie.Id.ToString(), m_MockFigurProperty.ChooseSerie.SelectedItem.Value); Assert.AreEqual(serie.Name, m_MockFigurProperty.ChooseSerie.SelectedItem.Text); }
public void Test_Update_IfNameAndPriceAreValid() { m_MockFigurProperty.Figur = new Figur{ Id = 0, Name = "name", Description = "desc", Price = (decimal)11.11, Serie = new Serie { Id = 1 }}; FigurPropertyPresenter figurPropertyService = new FigurPropertyPresenter(m_MockFigurProperty); figurPropertyService.SetFields(); Assert.IsTrue(figurPropertyService.Update(m_MockFigurProperty.Figur)); Assert.IsFalse(m_MockFigurProperty.ErrorMessage.Visible); Assert.AreEqual(string.Empty, m_MockFigurProperty.ErrorMessage.Text); //Revert saving IFigurService figurService = ObjectFactory.GetInstance<IFigurService>(); var figurs = figurService.GetAll(); figurService.DeleteById(figurs[figurs.Count - 1].Id); }
public void Test_SetFields_FigurIsNotNull() { FigurPropertyPresenter figurPropertyPresenter = new FigurPropertyPresenter(m_MockFigurProperty); m_MockFigurProperty.Figur = new Figur{ Id = 0, Name = "Test", Description = "Desc", Price = (decimal)11.11, Serie = new Serie { Id = 1 }}; figurPropertyPresenter.SetFields(); Assert.AreEqual("Test", m_MockFigurProperty.Name.Text); Assert.AreEqual("Desc", m_MockFigurProperty.Description.Text); Assert.AreEqual("11.11", m_MockFigurProperty.Price.Text); ISerieService serieService = ObjectFactory.GetInstance<ISerieService>(); var serie = serieService.GetById(1); Assert.AreEqual(serie.Id.ToString(), m_MockFigurProperty.ChooseSerie.SelectedItem.Value); Assert.AreEqual(serie.Name, m_MockFigurProperty.ChooseSerie.SelectedItem.Text); }