public void Add_WhenFixturePositionIsNotAvailable_ShouldThrowLogicException() { // Arrange DebitForAddDto debitForAddDto = new DebitForAddDto(); IDataResult <Fixture> fixtureDataResult = new SuccessDataResult <Fixture>(new Fixture() { FixturePositionId = 2 }); var mockDebitDal = new MockDebitDal().MockAdd(new Debit()); var mockFixtureService = new MockFixtureService().MockGetById(fixtureDataResult).MockUpdatePostiton(new SuccessResult()); var sut = new DebitManager(mockDebitDal.Object, mockFixtureService.Object); // Act & Assert Assert.Throws <LogicException>(() => sut.Add(debitForAddDto)); }
public void Add_WhenAddedNewDebit_ShouldAddAndReturnId() { // Arrange DebitForAddDto debitForAddDto = new DebitForAddDto(); IDataResult <Fixture> fixtureDataResult = new SuccessDataResult <Fixture>(new Fixture() { FixturePositionId = 1 }); var mockDebitDal = new MockDebitDal().MockAdd(new Debit()); var mockFixtureService = new MockFixtureService().MockGetById(fixtureDataResult).MockUpdatePostiton(new SuccessResult()); var sut = new DebitManager(mockDebitDal.Object, mockFixtureService.Object); // Act var result = sut.Add(debitForAddDto); // Assert Assert.Equal(new Guid(), result.Data); }