Exemple #1
0
        public void TestSaveAttachmentsToEmptyFolder()
        {
            var directory = new System.IO.DirectoryInfo(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));

            var store = new RfiCoder.Entity.Store();

            store.ProjectNumber = 1305015;

            store.Program = RfiCoder.Enum.ProgramTypes.NewStores;

            store.City = "Oconomowoc";

            var fileHandler = new RfiCoder.Utilities.FileHandler(store);

            var email = new Microsoft.Exchange.WebServices.Data.EmailMessage(
                RfiCoder.Utilities.EmailHelper.InstanceOf.GetEmailService);

            email.Subject = @"WM Store #9999 Sink Drain Dimensions RFI";

            var files = directory.GetFiles();

            var randGen = new System.Random();

            var pt = randGen.Next(1, files.Length);

            var file = files[pt];

            email.Attachments.AddFileAttachment(file.Name, file.OpenRead());

            email.Save(Microsoft.Exchange.WebServices.Data.WellKnownFolderName.Drafts);

            var result = fileHandler.SaveAttachmentsToFolder(email.Attachments);

            email.Delete(Microsoft.Exchange.WebServices.Data.DeleteMode.HardDelete);
        }
Exemple #2
0
        public void TestSaveAttachmentsToFolderWithDuplicateFile()
        {
            var store = new RfiCoder.Entity.Store();

            store.ProjectNumber = 1304007;

            store.Program = RfiCoder.Enum.ProgramTypes.NewStores;

            store.City = "Austin (lakeline)";

            var fileHandler = new RfiCoder.Utilities.FileHandler(store);

            var email = new Microsoft.Exchange.WebServices.Data.EmailMessage(
                RfiCoder.Utilities.EmailHelper.InstanceOf.GetEmailService);

            email.Subject = @"WM Store #9999 Sink Drain Dimensions RFI";

            var directory = new System.IO.DirectoryInfo(fileHandler.Path);

            var files = directory.GetFiles();

            var randGen = new System.Random();

            var pt = randGen.Next(1, files.Length);

            var file = files[pt];

            email.Attachments.AddFileAttachment(file.Name, file.OpenRead());

            email.Save(Microsoft.Exchange.WebServices.Data.WellKnownFolderName.Drafts);

            var result = fileHandler.SaveAttachmentsToFolder(email.Attachments);

            email.Delete(Microsoft.Exchange.WebServices.Data.DeleteMode.HardDelete);

            Assert.That(result, Is.False);
        }