Ejemplo n.º 1
0
        public void CanSave_PublisherIsNull_ReturnsFalse()
        {
            var model = new AddEditSeriesViewModel(null, null, null);

            model.CheckPassedSeriesAsync(null);
            model.SetErrorsChangedEventAsync();
            model.InputModel.Name        = "Random Name";
            model.InputModel.Description = "Rand desc";

            Assert.False(model.CanSave);
        }
Ejemplo n.º 2
0
        public void NameErrorMessage_SetsProperly()
        {
            var model = new AddEditSeriesViewModel(null, null, null);

            model.CheckPassedSeriesAsync(null);
            model.SetErrorsChangedEventAsync();
            model.InputModel.Name = " ";

            Assert.True(model.InputModel.HasErrors);
            Assert.False(model.CanSave);
            Assert.Equal(model.InputModel.GetFirstError("Name"), model.NameErrorMessage);
        }
Ejemplo n.º 3
0
        public async Task GetPublishersFromRepository_ValidCall()
        {
            var mock           = TestData.GetPublishersSample();
            var mockRepository = new Mock <IRepository <Publisher> >();

            mockRepository.Setup(x => x.GetAll()).Returns(mock);

            var model = new AddEditSeriesViewModel(null, mockRepository.Object, null);

            await model.GetPublishersFromRepositoryAsync().ConfigureAwait(true);

            Assert.NotNull(model.Publishers);
            Assert.Equal(3, model.Publishers.Count);
        }