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