Exemplo n.º 1
0
        public void Test_AwbRepository_GetClientEmails()
        {
            var data1 = CreateApplicationData(TestConstants.TestClientId1);
            var data2 = CreateApplicationData(TestConstants.TestClientId2);

            var id = _awbs.Add(CreateAirWaybillData(), TestConstants.DefaultStateId, TestConstants.TestAdminUserId);

            var a1 = _applicationEditor.Add(data1);
            var a2 = _applicationEditor.Add(data2);

            _applicationEditor.SetAirWaybill(a1, id);
            _applicationEditor.SetAirWaybill(a2, id);

            var emails = _awbs.GetClientEmails(id).Select(x => x.Email).ToArray();

            var clientRepository = new ClientRepository(_executor);

            var client1 = clientRepository.Get(TestConstants.TestClientId1);
            var client2 = clientRepository.Get(TestConstants.TestClientId2);
            var clients = new[] { client1, client2 };

            emails.ShouldAllBeEquivalentTo(clients.Select(x => x.Emails).ToArray());
        }
Exemplo n.º 2
0
        private ApplicationEditData CreateTestApplication(out long id)
        {
            var application = _fixture
                              .Build <ApplicationEditData>()
                              .With(x => x.SenderId, TestConstants.TestSenderId)
                              .With(x => x.ClientId, TestConstants.TestClientId1)
                              .With(x => x.TransitId, TestConstants.TestTransitId)
                              .With(x => x.CountryId, TestConstants.TestCountryId)
                              .With(x => x.AirWaybillId, null)
                              .With(x => x.ForwarderId, TestConstants.TestForwarderId1)
                              .Create();

            id = _editor.Add(application);

            return(application);
        }