public void TestRefreshGeneratedNotInLocalDiffersFromCore() { var vmAsset = new AssetViewModelBaseHarness(); vmAsset.Published.Asset = new TestAssetUnofficial(1235, "TitleP", "DescriptionP") { BadgeName = "BadgeP" }; vmAsset.Generated.Asset = new TestAsset(1234, "Title", "Description") { BadgeName = "Badge", SourceLine = 65 }; vmAsset.Refresh(); Assert.That(vmAsset.Id, Is.EqualTo(1234)); Assert.That(vmAsset.Title, Is.EqualTo("Title")); Assert.That(vmAsset.Description, Is.EqualTo("Description")); Assert.That(vmAsset.IsTitleModified, Is.True); Assert.That(vmAsset.IsDescriptionModified, Is.True); Assert.That(vmAsset.BadgeName, Is.EqualTo("Badge")); Assert.That(vmAsset.CompareState, Is.EqualTo(GeneratedCompareState.PublishedDiffers)); Assert.That(vmAsset.ModificationMessage, Is.EqualTo("Unofficial differs from generated")); Assert.That(vmAsset.IsGenerated, Is.True); Assert.That(vmAsset.CanUpdate, Is.True); Assert.That(vmAsset.Other, Is.SameAs(vmAsset.Published)); Assert.That(vmAsset.SourceLine, Is.EqualTo(65)); Assert.That(vmAsset.Triggers.Count(), Is.EqualTo(1)); Assert.That(vmAsset.Triggers.ElementAt(0), Is.InstanceOf <TriggerComparisonViewModel>()); Assert.That(vmAsset.Triggers.ElementAt(0).Label, Is.EqualTo("Trigger1234")); Assert.That(vmAsset.TriggerSource, Is.EqualTo("Generated (Not in Local)")); }
public void TestRefreshGeneratedSameAsLocal() { var vmAsset = new AssetViewModelBaseHarness(); vmAsset.Local.Asset = new TestAsset(1234, "Title", "Description") { BadgeName = "Badge" }; vmAsset.Generated.Asset = new TestAsset(1234, "Title", "Description") { BadgeName = "Badge", SourceLine = 65 }; vmAsset.Refresh(); Assert.That(vmAsset.Id, Is.EqualTo(1234)); Assert.That(vmAsset.Title, Is.EqualTo("Title")); Assert.That(vmAsset.Description, Is.EqualTo("Description")); Assert.That(vmAsset.IsTitleModified, Is.False); Assert.That(vmAsset.IsDescriptionModified, Is.False); Assert.That(vmAsset.BadgeName, Is.EqualTo("Badge")); Assert.That(vmAsset.CompareState, Is.EqualTo(GeneratedCompareState.Same)); Assert.That(vmAsset.ModificationMessage, Is.Null); Assert.That(vmAsset.IsGenerated, Is.True); Assert.That(vmAsset.CanUpdate, Is.False); Assert.That(vmAsset.Other, Is.Null); Assert.That(vmAsset.SourceLine, Is.EqualTo(65)); Assert.That(vmAsset.Triggers.Count(), Is.EqualTo(1)); Assert.That(vmAsset.Triggers.ElementAt(0), Is.Not.InstanceOf <TriggerComparisonViewModel>()); Assert.That(vmAsset.Triggers.ElementAt(0).Label, Is.EqualTo("Trigger1234")); Assert.That(vmAsset.TriggerSource, Is.EqualTo("Generated (Same as Local)")); }
public void TestInitialization() { var vmAsset = new AssetViewModelBaseHarness(); Assert.That(vmAsset.BadgeName, Is.Null); Assert.That(vmAsset.CanUpdate, Is.False); Assert.That(vmAsset.CompareState, Is.EqualTo(GeneratedCompareState.None)); Assert.That(vmAsset.DeleteLocalCommand, Is.InstanceOf <DisabledCommand>()); Assert.That(vmAsset.Description, Is.EqualTo("")); Assert.That(vmAsset.Generated, Is.Not.Null); Assert.That(vmAsset.Id, Is.EqualTo(0)); Assert.That(vmAsset.IsDescriptionModified, Is.False); Assert.That(vmAsset.IsGenerated, Is.False); Assert.That(vmAsset.IsPointsModified, Is.False); Assert.That(vmAsset.IsTitleModified, Is.False); Assert.That(vmAsset.Local, Is.Not.Null); Assert.That(vmAsset.ModificationMessage, Is.Null); Assert.That(vmAsset.Other, Is.Null); Assert.That(vmAsset.Points, Is.EqualTo(0)); Assert.That(vmAsset.Published, Is.Not.Null); Assert.That(vmAsset.SourceLine, Is.EqualTo(0)); Assert.That(vmAsset.Title, Is.EqualTo("")); Assert.That(vmAsset.Triggers.Count(), Is.EqualTo(0)); Assert.That(vmAsset.TriggerSource, Is.EqualTo("Generated")); Assert.That(vmAsset.UpdateLocalCommand, Is.InstanceOf <DisabledCommand>()); Assert.That(vmAsset.ViewerImage, Is.EqualTo("/RATools;component/Resources/test.png")); Assert.That(vmAsset.ViewerType, Is.EqualTo("Test")); }