public void TestThatManipulateDataReturnsWithManipulatedDataIfTableTargetNameMatchTableNameInTheConstructor() { 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.DataIsManipulated, Is.False); var data = new Collection <IEnumerable <IDataObjectBase> >(); var manipulatedData = dataManipulator.ManipulateData(fixture.CreateAnonymous <ITable>(), data); Assert.That(manipulatedData, Is.Not.Null); Assert.That(manipulatedData, Is.EqualTo(data)); Assert.That(dataManipulator.DataIsManipulated, Is.True); tableMock.AssertWasCalled(m => m.NameTarget); }
public void TestThatManipulateDataThrowsArgumentNullExceptionIfTableIsNull() { var fixture = new Fixture(); var dataManipulator = new MyDataManipulator(fixture.CreateAnonymous <string>()); Assert.That(dataManipulator, Is.Not.Null); Assert.Throws <ArgumentNullException>(() => dataManipulator.ManipulateData(null, new Collection <IEnumerable <IDataObjectBase> >())); }
public void TestThatManipulateDataThrowsArgumentNullExceptionIfDataIsNull() { 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.ManipulateData(fixture.CreateAnonymous <ITable>(), null)); }