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_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); }