/// <summary> /// Gets a sample component manifest XML /// </summary> /// <returns>List<System.String>.</returns> public static string GetSampleProjectInfoSerialized() { ProjectInfo info = GetSampleProjectInfo(); XElement xElement = ManifestSerializer.SerializeProjectInfo(info); return(xElement.ToString()); }
/// <summary> /// Gets an empty component manifest XML /// </summary> /// <returns>List<System.String>.</returns> public static string GetEmptyProjectInfoSerialized() { ProjectInfo info = GetEmptyProjectInfo(); info.RepositoryInfo.RepositoryName = "MISC"; info.RepositoryInfo.OrganizationName = "MISC"; XElement xElement = ManifestSerializer.SerializeProjectInfo(info); return(xElement.ToString()); }
public void ProcessManifestTest() { var expected = new Manifest { new Kanyon.Kubernetes.Core.V1.Namespace(), new Kubernetes.Apps.V1.Deployment() }; var sut = new ManifestSerializer(new NoOpManifestFilter()); var actual = sut.ProcessManifest(expected); Assert.IsTrue(actual.Contains("\n---\n")); }
public void ProcessManifest_RespectsFilters() { Mock <IManifestFilter> filterMock = new Mock <IManifestFilter>(); filterMock.Setup(filter => filter.Filter(It.Is <IManifestObject>(imo => imo.Kind == "Namespace"))).Returns(false); var expected = new Manifest { new Kanyon.Kubernetes.Core.V1.Namespace(), new Kubernetes.Apps.V1.Deployment() }; var sut = new ManifestSerializer(filterMock.Object); var actual = sut.ProcessManifest(expected); Assert.IsFalse(actual.Contains("kind: Namespace")); }
public void Serialization_BackAndForth() { ProjectInfo info = SampleManifestXmlProvider.GetSampleProjectInfo(); info.Properties.Add("Collection", new List <string>() { "First", "Second" }); info.Components[0].Properties.Add("ComponentCollection", new List <string>() { "Third", "Second" }); XElement projectInfoSerialized = ManifestSerializer.SerializeProjectInfo(info); ProjectInfo projectInfoDeserialized = ManifestDeserializer.DeserializeProjectInfo(projectInfoSerialized); projectInfoDeserialized.Should().BeEquivalentTo(info); }