public void UpdateTermForModClassId_WithBlankTerm_ThrowsException() { var creator = Mocks.DynamicMock<IDnaDataReaderCreator>(); Mocks.ReplayAll(); var target = new Term { Value = "" }; try { target.UpdateTermForModClassId(creator, 1, 1); } catch (Exception e) { Assert.AreEqual("Term value cannot be empty.", e.Message); } creator.AssertWasNotCalled(x => x.CreateDnaDataReader("addtermsfilterterm")); }
public void UpdateTermForModClassId_WithoutModclassId_ThrowsException() { var creator = Mocks.DynamicMock<IDnaDataReaderCreator>(); //creator.Stub(x => x.CreateDnaDataReader("addtermsfilterterm")).Return(reader); Mocks.ReplayAll(); var target = new Term{Value="term"}; int modClassId = 0; try { target.UpdateTermForModClassId(creator, modClassId, 1); } catch (Exception e) { Assert.AreEqual("ModClassId cannot be 0.", e.Message); } creator.AssertWasNotCalled(x => x.CreateDnaDataReader("addtermsfilterterm")); }
public void UpdateTermForModClassId_ValueInput_ReturnsNoException() { var reader = Mocks.DynamicMock<IDnaDataReader>(); var creator = Mocks.DynamicMock<IDnaDataReaderCreator>(); creator.Stub(x => x.CreateDnaDataReader("addtermsfilterterm")).Return(reader); Mocks.ReplayAll(); var target = new Term { Value = "term" }; target.UpdateTermForModClassId(creator, 1, 1); creator.AssertWasCalled(x => x.CreateDnaDataReader("addtermsfilterterm")); }