Exemple #1
0
        public void test_share_name(string shareName)
        {
            string serverName  = "localhost";
            string destination = @".\temp";

            if (!Directory.Exists(destination))
            {
                Directory.CreateDirectory(destination);
            }
            Win32Share.Create(serverName, shareName, destination, "");

            var server = new DeploymentServer(serverName);
            var actual = _path.GetPhysicalPath(server, @"~\{0}".FormatWith(shareName), false);

            Win32Share.Delete(serverName, shareName);

            Assert.AreEqual(System.IO.Path.GetFullPath(destination), actual);
        }
        public DeploymentResult Execute()
        {
            var result = new DeploymentResult();

            if (DeleteAndRecreate)
            {
                Win32Share.Delete(Server, ShareName);
            }

            ShareReturnCode returnCode = Win32Share.Create(Server, ShareName, PointingTo, Description);

            if (returnCode != ShareReturnCode.Success)
            {
                throw new Exception("Unable to share directory '{0}' as '{2}' on '{1}'.".FormatWith(PointingTo, Server, ShareName));
            }

            result.AddGood("Created share");

            return(result);
        }