コード例 #1
0
        public void GetDescriptionAndText_WithMissingCommentInInput_ReturnsEmptyDescriptionAndValidText()
        {
            ResourceSnippetsProvider resourceSnippetsProvider = new ResourceSnippetsProvider();

            string template = @"resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = {
  name: '${1:dnsZone}'
  location: 'global'
  tags: {
    displayName: '${1:dnsZone}'
  }
}";

            (string description, string text) = resourceSnippetsProvider.GetDescriptionAndText(template);

            string expectedText = @"resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = {
  name: '${1:dnsZone}'
  location: 'global'
  tags: {
    displayName: '${1:dnsZone}'
  }
}";

            Assert.IsTrue(description.Equals(string.Empty));
            Assert.AreEqual(expectedText, text);
        }
コード例 #2
0
        public void GetDescriptionAndText_WithValidInput_ReturnsDescriptionAndText()
        {
            ResourceSnippetsProvider resourceSnippetsProvider = new ResourceSnippetsProvider();

            string template = @"// DNS Zone
resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = {
  name: '${1:dnsZone}'
  location: 'global'
  tags: {
    displayName: '${1:dnsZone}'
  }
}";

            (string description, string text) = resourceSnippetsProvider.GetDescriptionAndText(template);

            string expectedText = @"resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = {
  name: '${1:dnsZone}'
  location: 'global'
  tags: {
    displayName: '${1:dnsZone}'
  }
}";

            Assert.AreEqual("DNS Zone", description);
            Assert.AreEqual(expectedText, text);
        }
コード例 #3
0
        public void GetDescriptionAndText_WithOnlyWhitespaceInput_ReturnsEmptyDescriptionAndText()
        {
            ResourceSnippetsProvider resourceSnippetsProvider = new ResourceSnippetsProvider();

            (string description, string text) = resourceSnippetsProvider.GetDescriptionAndText("   ");

            Assert.IsTrue(description.Equals(string.Empty));
            Assert.IsTrue(text.Equals(string.Empty));
        }
コード例 #4
0
        public void GetDescriptionAndText_WithCommentAndMissingDeclarations_ReturnsEmptyDescriptionAndText()
        {
            ResourceSnippetsProvider resourceSnippetsProvider = new ResourceSnippetsProvider();

            string template = @"// DNS Zone";

            (string description, string text) = resourceSnippetsProvider.GetDescriptionAndText(template);

            Assert.IsTrue(description.Equals(string.Empty));
            Assert.IsTrue(text.Equals(string.Empty));
        }