Esempio n. 1
0
            public void Should_Throw_If_Context_Is_Null()
            {
                // Given, When
                var result = Record.Exception(() => FileAliases.MakeAbsolute(null, "./build.txt"));

                // Then
                Assert.IsArgumentNullException(result, "context");
            }
Esempio n. 2
0
            public void Should_Throw_If_Path_Is_Null()
            {
                // Given
                var context = Substitute.For <ICakeContext>();

                // When
                var result = Record.Exception(() => FileAliases.MakeAbsolute(context, null));

                // Then
                Assert.IsArgumentNullException(result, "path");
            }
Esempio n. 3
0
            public void Should_Return_Absolute_Directory_Path()
            {
                // Given
                var context = Substitute.For <ICakeContext>();

                context.Environment.WorkingDirectory.Returns(d => "/Working");

                // When
                var result = FileAliases.MakeAbsolute(context, "./build.txt");

                // Then
                Assert.Equal("/Working/build.txt", result.FullPath);
            }
        public static void ModifyUnicornSourceFolder(this ICakeContext context, string unicornSerializationFolder, string DevSettingsFile, string sourceFolderName)
        {
            var rootXPath         = "configuration/sitecore/sc.variable[@name='{0}']/@value";
            var directoryPath     = FileAliases.MakeAbsolute(context, unicornSerializationFolder).FullPath;
            var sourceFolderXPath = string.Format(rootXPath, sourceFolderName);

            var xmlSetting = new XmlPokeSettings
            {
                Namespaces = new Dictionary <string, string> {
                    { "patch", @"http://www.sitecore.net/xmlconfig/" }
                }
            };

            context.XmlPoke(DevSettingsFile, sourceFolderXPath, directoryPath, xmlSetting);
        }