Example #1
0
        public void Output_file_should_be_written()
        {
            //  arrange
            if (File.Exists(outputFilePath))
            {
                File.Delete(outputFilePath);
            }
            var contacts = A.CollectionOfDummy <Contact>(_random.Next(100));

            _handler = new WriteResultIdsToFileHandler(outputFilePath);

            //  act
            _handler.HandlePotentialCustomers(contacts);

            //  assert
            File.Exists(outputFilePath).Should().BeTrue();
        }
Example #2
0
        public void Should_write_contacts_ids()
        {
            //  arrange
            if (File.Exists(outputFilePath))
            {
                File.Delete(outputFilePath);
            }
            var contacts = A.CollectionOfDummy <Contact>(_random.Next(100));

            _handler = new WriteResultIdsToFileHandler(outputFilePath);

            //  act
            _handler.HandlePotentialCustomers(contacts);
            var ids = File.ReadAllLines(outputFilePath).Select(o => long.Parse(o));

            //  assert
            ids.ShouldBeEquivalentTo(contacts.Select(o => o.PersonId));
        }