public void TestInitialize()
 {
     notificationProviderMock = new NotificationProviderMock();
     NotificationMessageProvider.Initialize(notificationProviderMock, 1000000);
     apiConnectorMock      = new ApiConnectorMock();
     navigationManagerMock = new NavigationManagerMock();
 }
 public void TestInitialize()
 {
     notificationProviderMock = new NotificationProviderMock();
     NotificationMessageProvider.Initialize(notificationProviderMock, 1000000);
     mock        = new ApiConnectorMock();
     saveCommand = new EntitySaveCommand <Card>(mock)
     {
         Entity = card
     };
 }
Example #3
0
 public void TestInitialize()
 {
     notificationProviderMock = new NotificationProviderMock();
     NotificationMessageProvider.Initialize(notificationProviderMock, 1000000);
     apiConnectorMock      = new ApiConnectorMock();
     navigationManagerMock = new NavigationManagerMock();
     viewModel             = new TestViewModel(navigationManagerMock, apiConnectorMock)
     {
         Id = 12
     };
 }
 public void TestInitialize()
 {
     notificationProviderMock = new NotificationProviderMock();
     NotificationMessageProvider.Initialize(notificationProviderMock, 1000000);
     mock = new ApiConnectorMock();
     dialogProviderMock = new DialogProviderMock();
     deleteCommand      = new EntityDeleteCommand <Card>(mock)
     {
         Entity = card
     };
     ModalDialogManager.Initialize(dialogProviderMock);
 }
Example #5
0
        public async Task ErrorOnLoadingPracticeHistoryEntriesTest()
        {
            NotificationProviderMock notificationProviderMock = new NotificationProviderMock();

            NotificationMessageProvider.Initialize(notificationProviderMock, 500000);
            ApiConnectorMock        mock      = CreateApiConnectorMock(deck, false, null);
            DeckStatisticsViewModel viewModel = new DeckStatisticsViewModel(navigationManagerMock, mock);
            bool result = await viewModel.InitializeAsync();

            Assert.IsFalse(result);
            Assert.AreEqual(NotificationKind.ErrorNotification, notificationProviderMock.NotificationKind);
            Assert.AreEqual("test-error", notificationProviderMock.Message);
        }
        public async Task ErrorOnLoadingPracticeHistoryEntriesTest()
        {
            NotificationProviderMock notificationProviderMock = new NotificationProviderMock();

            NotificationMessageProvider.Initialize(notificationProviderMock, 500000);
            Card card = new Card()
            {
                CardId = 1
            };

            card.Fields.Add(new CardField()
            {
                FieldId = 1, FieldName = "Field 1"
            });
            card.Fields.Add(new CardField()
            {
                FieldId = 2, FieldName = "Field 2"
            });
            ApiConnectorMock mock = new ApiConnectorMock();

            mock.Replies.Push(new ApiReply <List <PracticeHistoryEntry> >()
            {
                WasSuccessful = false,
                ResultMessage = "test-error"
            });
            mock.Replies.Push(new ApiReply <Card>()
            {
                WasSuccessful = true,
                Result        = card
            });
            CardStatisticsViewModel viewModel = new CardStatisticsViewModel(navigationManagerMock, mock);
            bool result = await viewModel.InitializeAsync();

            Assert.IsFalse(result);
            Assert.AreEqual(NotificationKind.ErrorNotification, notificationProviderMock.NotificationKind);
            Assert.AreEqual("test-error", notificationProviderMock.Message);
        }
Example #7
0
 public void TestInitialize()
 {
     NotificationMessageProvider.Initialize(notificationProviderMock, 500000);
 }
 public void TestInitialize()
 {
     mock = new NotificationProviderMock();
     NotificationMessageProvider.Initialize(mock, 100);
 }
Example #9
0
        public void TestInitialize()
        {
            NotificationMessageProvider.Initialize(notificationProviderMock, 500000);

            template = new CardTemplate()
            {
                CardTemplateId = 1, Title = "template"
            };
            fieldDefinition1 = new CardFieldDefinition()
            {
                CardTemplate   = template,
                CardTemplateId = 1,
                FieldId        = 1,
                FieldName      = "Front"
            };
            fieldDefinition2 = new CardFieldDefinition()
            {
                CardTemplate   = template,
                CardTemplateId = 1,
                FieldId        = 2,
                FieldName      = "Back"
            };
            template.FieldDefinitions.Add(fieldDefinition1);
            template.FieldDefinitions.Add(fieldDefinition2);
            deck = new Deck()
            {
                DeckId = 1, DefaultCardTemplateId = 1, Title = "deck", DefaultCardTemplate = template
            };
            card1 = new Card()
            {
                CardId = 1, CardTemplateId = 1, CardTemplate = template, DeckId = 1, Deck = deck
            };
            field1 = new CardField()
            {
                CardFieldDefinition = fieldDefinition1,
                CardId         = 1,
                Card           = card1,
                CardTemplateId = 1,
                CardTemplate   = template,
                FieldId        = 1,
                FieldName      = "Front",
                Value          = "11",
                DueDate        = DateTime.Today
            };
            field2 = new CardField()
            {
                CardFieldDefinition = fieldDefinition2,
                CardId         = 1,
                Card           = card1,
                CardTemplateId = 1,
                CardTemplate   = template,
                FieldId        = 2,
                FieldName      = "Back",
                Value          = "12",
                DueDate        = DateTime.Today
            };
            card1.Fields.Add(field1);
            card1.Fields.Add(field2);
            card2 = new Card()
            {
                CardId = 2, CardTemplateId = 1, CardTemplate = template, DeckId = 1, Deck = deck
            };
            field3 = new CardField()
            {
                CardFieldDefinition = fieldDefinition1,
                CardId         = 2,
                Card           = card2,
                CardTemplateId = 1,
                CardTemplate   = template,
                FieldId        = 1,
                FieldName      = "Front",
                Value          = "21",
                DueDate        = DateTime.Today
            };
            field4 = new CardField()
            {
                CardFieldDefinition = fieldDefinition2,
                CardId         = 2,
                Card           = card2,
                CardTemplateId = 1,
                CardTemplate   = template,
                FieldId        = 2,
                FieldName      = "Back",
                Value          = "22",
                DueDate        = DateTime.Today.AddDays(1)
            };
            card2.Fields.Add(field3);
            card2.Fields.Add(field4);
            deck.Cards.Add(card1);
            deck.Cards.Add(card2);
        }