Ejemplo n.º 1
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            IEnumerable <LibraryInstallationState> list = (value as IEnumerable <ILibraryInstallationState>)
                                                          .Select(i => LibraryInstallationState.FromInterface(i));

            serializer.Serialize(writer, list);
        }
        public void FromInterface()
        {
            var state = new Mocks.LibraryInstallationState
            {
                ProviderId = "_prov_",
                Name = "_lib_",
                DestinationPath = "_path_",
                Files = new List<string>() { "a", "b" },
            };

            var lis = LibraryInstallationState.FromInterface(state);
            Assert.AreEqual(state.ProviderId, lis.ProviderId);
            Assert.AreEqual(state.Name, lis.Name);
            Assert.AreEqual(state.Version, lis.Version);
            Assert.AreEqual(state.DestinationPath, lis.DestinationPath);
            Assert.AreEqual(state.Files, lis.Files);
        }