public void CanRegisterInformation()
        {
            var service = new InformationService();
            service.Load("CommonLibrary.Web.Modules.Tests");

            Assert.AreEqual(service.Lookup.Count, 1);
            Assert.IsNotNull(service.Lookup["InfoTask.Test1"]);
            Assert.IsNotNull(service.Create("InfoTask.Test1"));
            Assert.AreEqual(service.Create("InfoTask.Test1").GetInfo(), "Testing information task");
        }
Exemplo n.º 2
0
        public void CanRegisterInformation()
        {
            var service = new InformationService();

            service.Load(ContentLoader.TestDllName);

            Assert.AreEqual(service.Lookup.Count, 1);
            Assert.IsNotNull(service.Lookup["InfoTask.Test1"]);
            Assert.IsNotNull(service.Create("InfoTask.Test1"));
            Assert.AreEqual(service.Create("InfoTask.Test1").GetInfo(), "Testing information task");
        }
        public void CanRegisterInformation()
        {
            var service = new InformationService();

            service.Load("CommonLibrary.Web.Modules.Tests");

            Assert.AreEqual(service.Lookup.Count, 1);
            Assert.IsNotNull(service.Lookup["InfoTask.Test1"]);
            Assert.IsNotNull(service.Create("InfoTask.Test1"));
            Assert.AreEqual(service.Create("InfoTask.Test1").GetInfo(), "Testing information task");
        }
        public async Task <IActionResult> Create(Information info)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            await _informationService.Create(info);

            return(Ok(info.id));
        }
Exemplo n.º 5
0
        public void CallOnce_EfDbContextSave_When_Information_IsNotNull()
        {
            // Arange
            var mockedMapper          = new Mock <IAutoMapperService>();
            var mockedEfDbContext     = new Mock <IEfDbContextSaveChanges>();
            var mockedIEfDbRepository = new Mock <IPhotoArtSystemEfDbRepository <Information> >();
            var service = new InformationService(mockedMapper.Object, mockedEfDbContext.Object, mockedIEfDbRepository.Object);

            // Act
            service.Create(new InformationTransitional());

            // Assert
            mockedEfDbContext.Verify(x => x.Save(), Times.Once);
        }
Exemplo n.º 6
0
        public void Throw_ArgumentNullException_WithProperMessage_When_Information_IsNull()
        {
            // Arange
            var mockedMapper          = new Mock <IAutoMapperService>();
            var mockedEfDbContext     = new Mock <IEfDbContextSaveChanges>();
            var mockedIEfDbRepository = new Mock <IPhotoArtSystemEfDbRepository <Information> >();
            var service = new InformationService(mockedMapper.Object, mockedEfDbContext.Object, mockedIEfDbRepository.Object);

            // Act & Assert
            Assert.That(
                () => service.Create(null),
                Throws.ArgumentNullException.With.Message.Contains(
                    GlobalConstants.InformationTransitionalRequiredExceptionMessage));
        }