public void CommandButtonCreateExecuteTest002_RankedFieldsNullForNonRankedGame()
        {
            Mock <ISettings> settingsMock = new Mock <ISettings>();

            EditGameViewModel model = new EditGameViewModel();

            string param = "Victory";

            PopulateObject(model.Game, StartProp);

            Assert.IsNotNull(model.Game.PlayerLegendRank);
            Assert.IsNotNull(model.Game.PlayerRank);
            Assert.IsNotNull(model.Game.OpponentLegendRank);
            Assert.IsNotNull(model.Game.OpponentRank);
            Assert.IsNotNull(model.Game.BonusRound);

            //set type to other than ranked value
            model.Game.Type = GameType.SoloArena;

            model.CommandButtonCreateExecute(param);

            Assert.IsNull(model.Game.PlayerLegendRank);
            Assert.IsNull(model.Game.PlayerRank);
            Assert.IsNull(model.Game.OpponentLegendRank);
            Assert.IsNull(model.Game.OpponentRank);
            Assert.IsNull(model.Game.BonusRound);
        }
        public void CommandButtonCreateExecuteTest003_ValidateRequiredFeilds()
        {
            Mock <ITrackerFactory> trackerFactory = new Mock <ITrackerFactory>();
            Mock <IMessenger>      messanger      = new Mock <IMessenger>();

            trackerFactory.Setup(tf => tf.GetService <IMessenger>()).Returns(messanger.Object);

            Mock <ISettings> settings = new Mock <ISettings>();

            trackerFactory.Setup(tf => tf.GetService <ISettings>()).Returns(settings.Object);

            Mock <ITracker> tracker = new Mock <ITracker>();

            tracker.Setup(t => t.Games).Returns(new ObservableCollection <DataModel.Game>());
            tracker.Setup(t => t.ActiveDeck).Returns <Deck>(null);

            trackerFactory.Setup(tf => tf.GetTracker()).Returns(tracker.Object);

            EditGameViewModel model = new EditGameViewModel();

            string param = "Victory";

            model.CommandButtonCreateExecute(param);

            Assert.IsNotNull(model.ErrorMessage);

            messanger.Verify(m => m.Send(It.IsAny <object>()), Times.Never);
        }
        public void CommandButtonCreateExecuteTest001_SaveSettingForCurrentPlayerRank()
        {
            Mock <ITrackerFactory> trackerFactory = new Mock <ITrackerFactory>();
            Mock <IMessenger>      messanger      = new Mock <IMessenger>();

            trackerFactory.Setup(tf => tf.GetService <IMessenger>()).Returns(messanger.Object);
            trackerFactory.Setup(tf => tf.GetService <IDeckService>()).Returns(new DeckService(trackerFactory.Object));

            Mock <ISettings> settings = new Mock <ISettings>();

            trackerFactory.Setup(tf => tf.GetService <ISettings>()).Returns(settings.Object);

            Mock <ITracker> tracker = new Mock <ITracker>();

            tracker.Setup(t => t.Games).Returns(new ObservableCollection <DataModel.Game>());
            tracker.Setup(t => t.ActiveDeck).Returns(new Deck(trackerFactory.Object));

            trackerFactory.Setup(tf => tf.GetTracker()).Returns(tracker.Object);

            Mock <IWinAPI> winApi = new Mock <IWinAPI>();

            winApi.Setup(w => w.GetEslFileVersionInfo()).Returns <FileVersionInfo>(null);

            trackerFactory.Setup(tf => tf.GetService <IWinAPI>()).Returns(winApi.Object);

            Mock <IFileManager> fileManager = new Mock <IFileManager>();

            trackerFactory.Setup(tf => tf.GetFileManager()).Returns(fileManager.Object);


            EditGameViewModel model = new EditGameViewModel(trackerFactory.Object);

            PlayerRank selectedPlayerRank = PlayerRank.TheLord;

            model.Game.Type          = GameType.PlayRanked;
            model.Game.OpponentClass = DeckClass.Crusader;
            model.Game.PlayerRank    = selectedPlayerRank;

            object param = "Victory";

            model.CommandButtonCreateExecute(param);

            settings.VerifySet(s => s.PlayerRank = selectedPlayerRank, Times.Once);
        }