Ejemplo n.º 1
0
        public TopicWindow(EditableTopic topic)
        {
            InitializeComponent();

            DataContext = ViewModelsFactory.Topic(topic);
            this.Loaded += OnLoad;
            this.Closing += OnClosing;
        }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 7
0
 public VersionRangesVM(EditableTopic editableTopic) : this()
 {
     VersionRanges = editableTopic.VersionRanges;
 }
Ejemplo n.º 8
0
 public static TopicVM Topic(EditableTopic topic)
 {
     return new TopicVM(ServicesFactory.Topic(), RepositoriesFactory.Product(), topic, new NotificationSender());
 }
Ejemplo n.º 9
0
 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)
             }
         }
     };
 }
Ejemplo n.º 10
0
 protected bool Equals(EditableTopic other)
 {
     return Equals(product, other.product) && string.Equals(TopicId, other.TopicId) && VersionRanges.SequenceEqual(other.VersionRanges);
 }