public void TestThatFinalizeDataManipulationReturnsWithFinalizedDataIfTableTargetNameMatchTableNameInTheConstructor() { var fixture = new Fixture(); var tableMock = MockRepository.GenerateMock <ITable>(); tableMock.Expect(m => m.NameTarget) .Return(fixture.CreateAnonymous <string>()) .Repeat.Any(); fixture.Customize <ITable>(e => e.FromFactory(() => tableMock)); var dataManipulator = new MyDataManipulator(tableMock.NameTarget); Assert.That(dataManipulator, Is.Not.Null); Assert.That(dataManipulator.DataIsFinalized, Is.False); var data = new Collection <IEnumerable <IDataObjectBase> >(); var manipulatedData = dataManipulator.FinalizeDataManipulation(fixture.CreateAnonymous <ITable>(), data); Assert.That(manipulatedData, Is.Not.Null); Assert.That(manipulatedData, Is.EqualTo(data)); Assert.That(dataManipulator.DataIsFinalized, Is.True); tableMock.AssertWasCalled(m => m.NameTarget); }
public void TestThatFinalizeDataManipulationThrowsArgumentNullExceptionIfTableIsNull() { var fixture = new Fixture(); var dataManipulator = new MyDataManipulator(fixture.CreateAnonymous <string>()); Assert.That(dataManipulator, Is.Not.Null); Assert.Throws <ArgumentNullException>(() => dataManipulator.FinalizeDataManipulation(null, new Collection <IEnumerable <IDataObjectBase> >())); }
public void TestThatFinalizeDataManipulationThrowsArgumentNullExceptionIfDataIsNull() { var fixture = new Fixture(); fixture.Customize <ITable>(e => e.FromFactory(() => MockRepository.GenerateMock <ITable>())); var dataManipulator = new MyDataManipulator(fixture.CreateAnonymous <string>()); Assert.That(dataManipulator, Is.Not.Null); Assert.Throws <ArgumentNullException>(() => dataManipulator.FinalizeDataManipulation(fixture.CreateAnonymous <ITable>(), null)); }