public void EditTable_ExceptionFromDataAccess() { //Arrange Changes var newNumber = 2; var newDescription = "Po prawej"; //Arrange Table var oldNumber = 1; var oldDescription = "Po lewej"; var table = new MoqTable(1, oldNumber, oldDescription); var mock = new Mock <IManagerDataAccess>(); mock.Setup(m => m.EditTable(It.IsAny <Table>())).Throws(new Exception()); //Arrange Bar Data Model var BarDataModel = new BarDataModel(mock.Object); //Act var result = BarDataModel.EditTable(table, newNumber, newDescription); //Assert Assert.IsFalse(result); Assert.AreEqual(table.Number, oldNumber); Assert.AreEqual(table.Description, oldDescription); }
public void EditTable_ValidExample() { //Arrange Changes var newNumber = 2; var newDescription = "Po prawej"; //Arrange Table var table = new MoqTable(1, 1, "Po lewej"); var mock = new Mock <IManagerDataAccess>(); mock.Setup(m => m.EditTable(It.IsAny <Table>())).Returns(true); //Arrange Bar Data Model var BarDataModel = new BarDataModel(mock.Object); //Act var result = BarDataModel.EditTable(table, newNumber, newDescription); //Assert Assert.IsTrue(result); Assert.AreEqual(table.Number, newNumber); Assert.AreEqual(table.Description, newDescription); }
public void EditTable_ValidExample() { //Arrange Changes var newNumber = 2; var newDescription = "Po prawej"; //Arrange Table var table = new MoqTable(1, 1, "Po lewej"); var mock = new Mock<IManagerDataAccess>(); mock.Setup(m => m.EditTable(It.IsAny<Table>())).Returns(true); //Arrange Bar Data Model var BarDataModel = new BarDataModel(mock.Object); //Act var result = BarDataModel.EditTable(table, newNumber, newDescription); //Assert Assert.IsTrue(result); Assert.AreEqual(table.Number, newNumber); Assert.AreEqual(table.Description, newDescription); }
public void EditTable_ExceptionFromDataAccess() { //Arrange Changes var newNumber = 2; var newDescription = "Po prawej"; //Arrange Table var oldNumber = 1; var oldDescription = "Po lewej"; var table = new MoqTable(1, oldNumber, oldDescription); var mock = new Mock<IManagerDataAccess>(); mock.Setup(m => m.EditTable(It.IsAny<Table>())).Throws(new Exception()); //Arrange Bar Data Model var BarDataModel = new BarDataModel(mock.Object); //Act var result = BarDataModel.EditTable(table, newNumber, newDescription); //Assert Assert.IsFalse(result); Assert.AreEqual(table.Number, oldNumber); Assert.AreEqual(table.Description, oldDescription); }