예제 #1
0
        public TopicWindow(EditableTopic topic)
        {
            InitializeComponent();

            DataContext = ViewModelsFactory.Topic(topic);
            this.Loaded += OnLoad;
            this.Closing += OnClosing;
        }
예제 #2
0
파일: TopicVM.cs 프로젝트: RonnyAnc/Papyrus
 public TopicVM(TopicService topicService, ProductRepository productRepository, EditableTopic topic, NotificationSender notificationSender) : this()
 {
     this.topicService = topicService;
     this.productRepository = productRepository;
     this.notificationSender = notificationSender;
     EditableTopic = topic;
     LastTopicSaved = topic.Clone();
 }
예제 #3
0
 private EditableTopic ATopicContainingADescendentVersionRange() {
     var versionRange = new EditableVersionRange {
         FromVersion = new ProductVersion("Any", "Any", DateTime.Today),
         ToVersion = new ProductVersion("Another", "Another", DateTime.Today.AddDays(-2))
     };
     var topic = new EditableTopic {
         Product = new DisplayableProduct(),
         TopicId = "AnyId",
         VersionRanges = new ObservableCollection<EditableVersionRange> { versionRange }
     };
     return topic;
 }
예제 #4
0
 public EditableTopic Clone()
 {
     var newTopic = new EditableTopic {
         Product = Product.Clone(),
         TopicId = TopicId,
     };
     var versionRanges = new ObservableCollection<EditableVersionRange>();
     foreach (var range in VersionRanges) {
         var copy = range.Clone();
         versionRanges.Add(copy);
     }
     newTopic.VersionRanges = versionRanges;
     return newTopic;
 }
예제 #5
0
 private static EditableTopic ATopicContainingADocumentWithEmptyTitle() {
     var versionRange = new EditableVersionRange {
         FromVersion = new ProductVersion("Any", "Any", DateTime.Today.AddDays(-2)),
         ToVersion = new ProductVersion("Another", "Another", DateTime.Today)
     };
     versionRange.Documents.Add(new EditableDocument {Title = ""});
     var versionRanges = new ObservableCollection<EditableVersionRange> {
         versionRange
     };
     var topic = new EditableTopic {
         Product = new DisplayableProduct(),
         TopicId = "AnyId",
         VersionRanges = versionRanges
     };
     return topic;
 }
예제 #6
0
        public void convert_itself_to_a_topic()
        {
            var opportunity = new DisplayableProduct
            {
                ProductId = "OpportunityId",
                ProductName = "Opportunity"
            };
            var editableVersionRange = new EditableVersionRange
            {
                FromVersion = new ProductVersion("FirstVersionId", "1.0", DateTime.Today.AddDays(-2)),
                ToVersion = new ProductVersion("SecondVersionId", "2.0", DateTime.Today),
            };
            var editableDocument = new EditableDocument
            {
                Title = "Título",
                Description = "Descripción",
                Content = "Contenido",
                Language = "es-ES"
            };
            editableVersionRange.Documents.Add(editableDocument);
            var editableVersionRanges = new ObservableCollection<EditableVersionRange>
            {
                editableVersionRange
            };
            var editableTopic = new EditableTopic
            {
                Product = opportunity,
                TopicId = "TopicId",
                VersionRanges = editableVersionRanges
            };

            var topic = editableTopic.ToTopic();

            topic.ProductId.Should().Be("OpportunityId");
            topic.TopicId.Should().Be("TopicId");
            topic.VersionRanges.Should().HaveCount(1);
            var versionRange = topic.VersionRanges.First();
            versionRange.FromVersionId.Should().Be(editableVersionRange.FromVersion.VersionId);
            versionRange.ToVersionId.Should().Be(editableVersionRange.ToVersion.VersionId);
            versionRange.Documents.Should().HaveCount(1);
            versionRange.Documents["es-ES"].ShouldBeEquivalentTo(editableDocument, options => options.Excluding(d => d.DocumentId));
        }
예제 #7
0
 public VersionRangesVM(EditableTopic editableTopic) : this()
 {
     VersionRanges = editableTopic.VersionRanges;
 }
예제 #8
0
 public static TopicVM Topic(EditableTopic topic)
 {
     return new TopicVM(ServicesFactory.Topic(), RepositoriesFactory.Product(), topic, new NotificationSender());
 }
예제 #9
0
파일: TopicVM.cs 프로젝트: RonnyAnc/Papyrus
 public DesignModeTopicVM()
 {
     EditableTopic = new EditableTopic
     {
         VersionRanges = new ObservableCollection<EditableVersionRange>
         {
             new EditableVersionRange
             {
                 FromVersion = new ProductVersion("AnyId", "1.0", DateTime.Today),
                 ToVersion = new ProductVersion("AnyId", "2.0", DateTime.Today)
             },
             new EditableVersionRange
             {
                 FromVersion = new ProductVersion("AnyId", "3.0", DateTime.Today),
                 ToVersion = new ProductVersion("AnyId", "4.0", DateTime.Today)
             }
         }
     };
 }
예제 #10
0
 protected bool Equals(EditableTopic other)
 {
     return Equals(product, other.product) && string.Equals(TopicId, other.TopicId) && VersionRanges.SequenceEqual(other.VersionRanges);
 }