public void CopyTestsvCardExternal() { var connector = new ContactClient(); var vcardConnector = new ContactClientVCards(true); var tempFolder = PrepareFolder(false); var file1 = Path.Combine(tempFolder, "file1"); var file2 = Path.Combine(tempFolder, "file2"); var path1 = Path.Combine(tempFolder, "vCards"); var originalList = connector.GetAll(file1); vcardConnector.WriteRange(originalList, path1); var copyList = vcardConnector.GetAll(path1); connector.WriteRange(copyList, file2); AssertOriginalAndCopyCompare(originalList, copyList, false); vcardConnector = new ContactClientVCards(true); vcardConnector.WriteRange(originalList, path1); Assert.IsTrue( File.Exists( Path.Combine( tempFolder, "vCards\\" + SyncTools.NormalizeFileName( originalList.GetElementById <StdContact>(ContactWithPicture).ToStringSimple())) + "-ContactPicture.jpg")); }
public void BasicTests() { var connector = new ContactClient(); Assert.AreEqual("FileSystem Contact Connector - one file for all contacts", connector.FriendlyClientName); var tempFolder = PrepareFolder(false); var listWithTwoContacts = connector.GetAll(Path.Combine(tempFolder, "file1")).ToStdContacts(); Assert.AreEqual(2, listWithTwoContacts.Count); Assert.AreEqual(0, listWithTwoContacts.GetElementById <StdContact>(ContactWithoutPicture).PictureData.Length); Assert.AreEqual(2090, listWithTwoContacts.GetElementById <StdContact>(ContactWithPicture).PictureData.Length); Assert.AreEqual("Sven", listWithTwoContacts.GetElementById <StdContact>(ContactWithPicture).Name.FirstName); Assert.AreEqual( Gender.Male, listWithTwoContacts.GetElementById <StdContact>(ContactWithPicture).PersonGender); Assert.AreEqual( Gender.Female, listWithTwoContacts.GetElementById <StdContact>(ContactWithoutPicture).PersonGender); }
public void CopyTestsCSV() { var connector = new ContactClient(); var csvConnector = new GenericClientCsv <StdContact>(); var tempFolder = PrepareFolder(false); var file1 = Path.Combine(tempFolder, "file1"); var file2 = Path.Combine(tempFolder, "file2"); var path1 = Path.Combine(tempFolder, "csv.csv"); var originalList = connector.GetAll(file1); originalList.Add(new StdContact()); csvConnector.WriteRange(originalList, path1); var copyList = csvConnector.GetAll(path1); copyList.Add(new StdContact()); connector.WriteRange(copyList, file2); AssertOriginalAndCopyCompare(originalList, copyList, true); }
public void CopyTestsIndividualFiles() { var connector = new ContactClient(); var individualFilesConnector = new ContactClientIndividualFiles(); var tempFolder = PrepareFolder(false); var file1 = Path.Combine(tempFolder, "file1"); var file2 = Path.Combine(tempFolder, "file2"); var path1 = Path.Combine(tempFolder, "vCards"); var originalList = connector.GetAll(file1); originalList.Add(new StdContact()); individualFilesConnector.WriteRange(originalList, path1); var copyList = individualFilesConnector.GetAll(path1); copyList.Add(new StdContact()); connector.WriteRange(copyList, file2); AssertOriginalAndCopyCompare(originalList, copyList, false); }
public void GoogleConnectorTestDataCheck() { var original = Contacts.GetStandardContactList(false); var connector = new ContactClient { LogOnUserId = "*****@*****.**", LogOnPassword = Tools.GetRegValue("Software\\Sem.Sync\\Test", "GoogleTestPassword", string.Empty) }; connector.WriteRange(original.ToStdElements(), string.Empty); var received = connector.GetAll(string.Empty).ToStdContacts(); var originalText = Contacts.SerializeList(original); var receivedText = Contacts.SerializeList(received); connector.DeleteElements(original.ToStdElements(), string.Empty); Assert.IsTrue(originalText == receivedText); }