public void ContractFindShortestPathTwoEntityWithContractFinished() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); MockRepository.Add(carrier); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); MockRepository.Add(mga); var contract = ContractMock.Get(carrier.Id, mga.Id); contract.Finished = true; MockRepository.Add(contract); MockRepository.Commit(); var model = ContractInputModelMock.Get(carrier.Id, mga.Id); // act var result = FindShortestPath(model); // assertation result.Should().BeEmpty(); }
public void ContractFindShortestPathWithIdEquals() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); MockRepository.Add(carrier); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); MockRepository.Add(mga); var contract = ContractMock.Get(carrier.Id, mga.Id); MockRepository.Add(contract); MockRepository.Commit(); var model = ContractInputModelMock.Get(carrier.Id, carrier.Id); // act Action action = () => FindShortestPath(model); // assertation action.Should().Throw <ValidationBusinessException>().WithMessage(ValidationMessage.ContractInvalid); }
public void ContractFindShortestPathTwoEntityValid() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); MockRepository.Add(carrier); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); MockRepository.Add(mga); var contract = ContractMock.Get(carrier.Id, mga.Id); MockRepository.Add(contract); MockRepository.Commit(); var model = ContractInputModelMock.Get(carrier.Id, mga.Id); // act var result = FindShortestPath(model); // assertation var carrierViewModelExpected1 = ContractPartViewModelMock.Get(key); var carrierViewModelExpected2 = ContractPartViewModelMock.Get(key2); result.Should().BeEquivalentTo(new List <ContractPartViewModel>() { carrierViewModelExpected1, carrierViewModelExpected2 }); }
public void ContractTerminateContractNotExists() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); MockRepository.Add(carrier); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); MockRepository.Add(mga); MockRepository.Commit(); var model = ContractInputModelMock.Get(carrier.Id, mga.Id); // act Action action = () => Terminate(model); // assertation action.Should().Throw <ValidationBusinessException>().WithMessage(ValidationMessage.ContractNotExists); var contracts = MockRepository.Query <Contract>().ToList(); contracts.Should().BeEmpty(); }
public void ContractEstablishTwoEntityValid() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); MockRepository.Add(carrier); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); MockRepository.Add(mga); MockRepository.Commit(); var model = ContractInputModelMock.Get(carrier.Id, mga.Id); // act Establish(model); // assertation var contracts = MockRepository.Query <Contract>().ToList(); var contractExpected = ContractMock.Get(carrier.Id, mga.Id); contracts.Should().BeEquivalentToEntity(new List <Contract>() { contractExpected }); }
public void ContractTerminateWithIdEquals() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); MockRepository.Add(carrier); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); MockRepository.Add(mga); var contract = ContractMock.Get(carrier.Id, mga.Id); MockRepository.Add(contract); MockRepository.Commit(); var model = ContractInputModelMock.Get(carrier.Id, carrier.Id); // act Action action = () => Terminate(model); // assertation action.Should().Throw <ValidationBusinessException>().WithMessage(ValidationMessage.ContractInvalid); var contracts = MockRepository.Query <Contract>().ToList(); var contractExpected = ContractMock.Get(carrier.Id, mga.Id); contracts.Should().BeEquivalentToEntity(new List <Contract>() { contractExpected }); }
public void ContractEstablishWithToIdEmpty() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); MockRepository.Add(carrier); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); MockRepository.Add(mga); MockRepository.Commit(); var model = ContractInputModelMock.Get(carrier.Id, Guid.Empty); // act Action action = () => Establish(model); // assertation action.Should().Throw <ValidationBusinessException>().WithMessage(ValidationMessage.IdInvalid); var contracts = MockRepository.Query <Contract>().ToList(); contracts.Should().BeEmpty(); }
public void ContractFindShortestPathComplex() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); MockRepository.Add(carrier); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); MockRepository.Add(mga); var key3 = Fake.GetKey(); var advisor = AdvisorMock.Get(key3); MockRepository.Add(advisor); var contract1 = ContractMock.Get(carrier.Id, mga.Id); MockRepository.Add(contract1); var contract2 = ContractMock.Get(mga.Id, advisor.Id); MockRepository.Add(contract2); var contract3 = ContractMock.Get(carrier.Id, advisor.Id); MockRepository.Add(contract3); MockRepository.Commit(); var model = ContractInputModelMock.Get(carrier.Id, advisor.Id); // act var result = FindShortestPath(model); // assertation var carrierViewModelExpected1 = ContractPartViewModelMock.Get(key); var carrierViewModelExpected3 = ContractPartViewModelMock.Get(key3); result.Should().BeEquivalentTo(new List <ContractPartViewModel>() { carrierViewModelExpected1, carrierViewModelExpected3 }); }
public void ContractFindShortestPathWithoutContractParts() { // arrange var key = Fake.GetKey(); var carrier = CarrierMock.Get(key); var key2 = Fake.GetKey(); var mga = MgaMock.Get(key2); var model = ContractInputModelMock.Get(carrier.Id, mga.Id); // act var result = FindShortestPath(model); // assertation result.Should().BeEmpty(); }