public void Test_CreateFilePath_Reference()
        {
            TestUser user = new TestUser();

            user.FirstName = "First";
            user.ID        = Guid.NewGuid();

            TestRole role = new TestRole();

            role.ID = Guid.NewGuid();

            user.Roles = new TestRole[] { role };

            string basePath = TestUtilities.GetTestingPath(this) + Path.DirectorySeparatorChar + "Export";

            EntityReference reference = DataAccess.Data.Referencer.GetActiveReferences(user)[0];

            string path = new EntityFileNamer(reference, basePath).CreateFilePath();

            string expected = basePath + Path.DirectorySeparatorChar
                              + role.ShortTypeName + "-" + user.ShortTypeName + Path.DirectorySeparatorChar
                              + reference.ID.ToString() + ".xml";

            Assert.AreEqual(expected, path, "The path doesn't match what's expected.");
        }
        public void Test_CreateFilePath_Entity()
        {
            TestUser user = new TestUser();

            user.FirstName = "First";
            user.ID        = Guid.NewGuid();

            string basePath = TestUtilities.GetTestingPath(this) + Path.DirectorySeparatorChar + "Export";

            string path = new EntityFileNamer(user, basePath).CreateFilePath();

            string expected = basePath + Path.DirectorySeparatorChar + user.GetType() + Path.DirectorySeparatorChar
                              + user.ID.ToString() + ".xml";

            Assert.AreEqual(expected, path, "The path doesn't match what's expected.");
        }
Esempio n. 3
0
        /// <summary>
        /// Creates the file path for the provided entity in the folder specified by the ImportedDirectoryPath property.
        /// </summary>
        /// <param name="entity">The entity to create the file path for.</param>
        /// <returns>The file path for the provided entity.</returns>
        public string CreateImportedEntityPath(IEntity entity)
        {
            string basePath = ImportedDirectoryPath + Path.DirectorySeparatorChar + GetPreviousVersion().ToString().Replace(".", "-");

            string fullPath = new EntityFileNamer(entity, basePath).CreateFilePath();

            return fullPath;
        }
Esempio n. 4
0
        /// <summary>
        /// Creates the file path for the provided entity in the folder specified by the ImportableDirectoryPath property.
        /// </summary>
        /// <param name="entity">The entity to create the file path for.</param>
        /// <returns>The file path for the provided entity.</returns>
        public string CreateImportableEntityPath(IEntity entity)
        {
            Guid id = entity.ID;

            string basePath = ImportableDirectoryPath;

            string fullPath = new EntityFileNamer(entity, basePath).CreateFilePath();

            return fullPath;
        }