public void CreateNewCardCommandShouldBeBoundToCorrectMethod()
        {
            WonderRulesCharacter testSubject = _TestData.EmptyRulesetCharacter();

            Assert.That(testSubject.CreateCardCommand,
                        Command.DelegatesTo(() => testSubject.CreateCardAndView()));
        }
        public void RulesEditorShouldNotifyThatPersistableDataHasChangedWhenAnyCardDataChanges()
        {
            WonderRulesCharacter testSubject = _TestData.EmptyRulesetCharacter();

            testSubject.Name = "new card name";
            testSubject.CreateUnboundCard();
            PropagateChangesTo(testSubject.CardData.First().Should(), () => testSubject.PersistableData);
        }
        public void ShouldBeAbleToCreateNewCardOnlyWhenNameIsProvided()
        {
            WonderRulesCharacter testSubject = _TestData.EmptyRulesetCharacter();

            testSubject.Name = string.Empty;
            testSubject.CreateCardCommand.CanExecute(null).Should().BeFalse();
            testSubject.Name = "No longer empty";
            testSubject.CreateCardCommand.CanExecute(null).Should().BeTrue();
        }
        public void CreatingNewCardShouldCreateBothDataAndTheControlAndSendProperNotification()
        {
            // This test checks a bunch of things at once because CreateCardAndView actually creates controls, so
            // is very expensive to call.
            WonderRulesCharacter testSubject = _TestData.EmptyRulesetCharacter();
            const string         cardName    = "The new card";

            testSubject.Name = cardName;

            testSubject.MonitorEvents();
            testSubject.CreateCardAndView();

            testSubject.CardData.Select(c => c.Name).Should().Equal(new object[] { cardName });
            testSubject.Cards.Select(c => c.DataContext.As <CardData>().Name).Should().Equal(new object[] { cardName });

            testSubject.ShouldRaisePropertyChangeFor(s => s.PersistableData);
        }
示例#5
0
 public static WonderRulesCharacter EmptyRulesetCharacter()
 {
     return(WonderRulesCharacter.CreateWithoutBackingDataStore(new RulesEditingSystem(), Data.Anything().Location));
 }
示例#6
0
 public static WonderRulesCharacter EmptyRulesetCharacter(IDataFile backingStore)
 {
     return(WonderRulesCharacter.Create(new RulesEditingSystem(), backingStore));
 }