public void Initialize() { this.mockExtension = new Mock<IInstalledExtension>(); this.extension = mockExtension.Object; this.reader = new Mock<ISchemaReader>().Object; this.resource = new Mock<ISchemaResource>().Object; this.target = new InstalledToolkitInfo(this.extension, this.reader, this.resource); }
public void WhenInitializing_ThenExtensionIsSet() { var extension = new Mock <IInstalledExtension>().Object; var target = new InstalledToolkitInfo(extension, this.reader, this.resource); Assert.Same(extension, target.Extension); }
public void Initialize() { this.mockExtension = new Mock <IInstalledExtension>(); this.extension = mockExtension.Object; this.reader = new Mock <ISchemaReader>().Object; this.resource = new Mock <ISchemaResource>().Object; this.target = new InstalledToolkitInfo(this.extension, this.reader, this.resource); }
public void WhenInitializing_ThenVersionIsExposed() { var extension = new Mock <IInstalledExtension>(); extension.Setup(ext => ext.Header.Version).Returns(new Version(0, 0, 0, 1)); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.Equal(new Version(0, 0, 0, 1), target.Version); }
public void WhenInitializing_ThenAuthorIsExposed() { var extension = new Mock <IInstalledExtension>(); extension.Setup(ext => ext.Header.Author).Returns("Foo"); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.Equal("Foo", target.Author); }
public void WhenInitializing_TheTemplatesEmpty() { var extension = new Mock <IInstalledExtension>(); extension.Setup(ext => ext.InstallPath).Returns(@"Z:\InstallDir"); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.NotNull(target.Templates); Assert.Equal(0, target.Templates.Count()); }
public void WhenInitializingAndIconIsNull_ThenIconPathIsNull() { var extension = new Mock <IInstalledExtension>(); extension.Setup(ext => ext.InstallPath).Returns(@"Z:\InstallDir"); extension.Setup(ext => ext.Header.Icon).Returns((string)null); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.Null(target.PatternIconPath); }
public void WhenInitializing_ThenDefaultClassification() { var extension = new Mock <IInstalledExtension>(); extension.Setup(ext => ext.Content).Returns(Enumerable.Empty <IExtensionContent>()); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.Equal(string.Empty, target.Classification.Category); Assert.Equal(ExtensionVisibility.Expanded, target.Classification.CustomizeVisibility); Assert.Equal(ExtensionVisibility.Expanded, target.Classification.CreateVisibility); }
public void WhenInitializing_ThenIconPathIsExposed() { var installPath = Path.GetTempPath(); var icon = Path.GetRandomFileName(); var iconPath = Path.Combine(installPath, icon); using (File.CreateText(iconPath)) { } var extension = new Mock <IInstalledExtension>(); extension.Setup(ext => ext.InstallPath).Returns(installPath); extension.Setup(ext => ext.Header.Icon).Returns(icon); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); File.Delete(iconPath); Assert.Equal(iconPath, target.ToolkitIconPath); }
public void Initialize() { var mock = new Mock <IInstalledExtension>(); mock.Setup(ext => ext.InstallPath).Returns(@"X:\"); mock.Setup(ext => ext.Content).Returns( new[] { Mocks.Of <IExtensionContent>().First(c => c.ContentTypeName == InstalledToolkitInfo.PatternModelCustomExtensionName && c.RelativePath == @"Foo.patterndefinition" && c.Attributes == new Dictionary <string, string> { { SchemaResource.AssemblyFileProperty, "Test.dll" } }), Mocks.Of <IExtensionContent>().First(c => c.ContentTypeName == "Other" && c.RelativePath == @"Documentation\Other.docx" && c.Attributes == new Dictionary <string, string> { { "IsCustomizable", bool.TrueString } }), Mocks.Of <IExtensionContent>().First(c => c.ContentTypeName == "Other" && c.RelativePath == @"Sample.file" && c.Attributes == new Dictionary <string, string> { { "IsCustomizable", bool.TrueString } }), }); this.extension = mock.Object; this.reader = new Mock <ISchemaReader>().Object; this.resource = new Mock <ISchemaResource>().Object; this.target = new InstalledToolkitInfo(this.extension, this.reader, this.resource); }
public void WhenInitializing_ThenNameIsExposed() { var extension = new Mock<IInstalledExtension>(); extension.Setup(ext => ext.Header.Name).Returns("Foo"); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.Equal("Foo", target.Name); }
public void WhenInitializing_ThenIconPathIsExposed() { var installPath = Path.GetTempPath(); var icon = Path.GetRandomFileName(); var iconPath = Path.Combine(installPath, icon); using (File.CreateText(iconPath)) { } var extension = new Mock<IInstalledExtension>(); extension.Setup(ext => ext.InstallPath).Returns(installPath); extension.Setup(ext => ext.Header.Icon).Returns(icon); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); File.Delete(iconPath); Assert.Equal(iconPath, target.ToolkitIconPath); }
public void WhenInitializing_ThenExtensionIsSet() { var extension = new Mock<IInstalledExtension>().Object; var target = new InstalledToolkitInfo(extension, this.reader, this.resource); Assert.Same(extension, target.Extension); }
public void WhenInitializing_ThenDefaultClassification() { var extension = new Mock<IInstalledExtension>(); extension.Setup(ext => ext.Content).Returns(Enumerable.Empty<IExtensionContent>()); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.Equal(string.Empty, target.Classification.Category); Assert.Equal(ExtensionVisibility.Expanded, target.Classification.CustomizeVisibility); Assert.Equal(ExtensionVisibility.Expanded, target.Classification.CreateVisibility); }
public void WhenInitializingAndIconIsNull_ThenIconPathIsNull() { var extension = new Mock<IInstalledExtension>(); extension.Setup(ext => ext.InstallPath).Returns(@"Z:\InstallDir"); extension.Setup(ext => ext.Header.Icon).Returns((string)null); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.Null(target.PatternIconPath); }
public void WhenInitializing_ThenVersionIsExposed() { var extension = new Mock<IInstalledExtension>(); extension.Setup(ext => ext.Header.Version).Returns(new Version(0, 0, 0, 1)); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.Equal(new Version(0, 0, 0, 1), target.Version); }
public void WhenInitializing_TheTemplatesEmpty() { var extension = new Mock<IInstalledExtension>(); extension.Setup(ext => ext.InstallPath).Returns(@"Z:\InstallDir"); var target = new InstalledToolkitInfo(extension.Object, this.reader, this.resource); Assert.NotNull(target.Templates); Assert.Equal(0, target.Templates.Count()); }
public void Initialize() { var mock = new Mock<IInstalledExtension>(); mock.Setup(ext => ext.InstallPath).Returns(@"X:\"); mock.Setup(ext => ext.Content).Returns( new[] { Mocks.Of<IExtensionContent>().First(c => c.ContentTypeName == InstalledToolkitInfo.PatternModelCustomExtensionName && c.RelativePath == @"Foo.patterndefinition" && c.Attributes == new Dictionary<string, string> { { SchemaResource.AssemblyFileProperty, "Test.dll" } }), Mocks.Of<IExtensionContent>().First(c => c.ContentTypeName == "Other" && c.RelativePath == @"Documentation\Other.docx" && c.Attributes == new Dictionary<string, string> { { "IsCustomizable", bool.TrueString } }), Mocks.Of<IExtensionContent>().First(c => c.ContentTypeName == "Other" && c.RelativePath == @"Sample.file" && c.Attributes == new Dictionary<string, string> { { "IsCustomizable", bool.TrueString } }), }); this.extension = mock.Object; this.reader = new Mock<ISchemaReader>().Object; this.resource = new Mock<ISchemaResource>().Object; this.target = new InstalledToolkitInfo(this.extension, this.reader, this.resource); }