Exemplo n.º 1
0
        public void Db_ErrorsReportingService_GetApplication()
        {
            using (IUnityContainer childContainer = this.container.CreateChildContainer())
            {
                IErrorsReportingService service     = childContainer.Resolve <IErrorsReportingService>();
                ErrorReportApplication  application = service.GetApplication("TestApplicationAlreadyExisting", "a.a.a.a");

                Assert.Greater(application.Id, 0);
                Assert.AreEqual(new DateTime(2000, 1, 1), application.FirstRunDate);
            }
        }
Exemplo n.º 2
0
        public void Db_ErrorsReportingService_GetApplication_NotExisting()
        {
            using (IUnityContainer childContainer = this.container.CreateChildContainer())
            {
                IErrorsReportingService service     = childContainer.Resolve <IErrorsReportingService>();
                ErrorReportApplication  application = null;
                Assert.That(() =>
                {
                    application = service.GetApplication("TestApplicationAlreadyExisting", "1.1.0.0");
                }, Throws.Nothing);

                Assert.IsNull(application);
            }
        }
        public void GetApplication()
        {
            VolatileDataset store = new VolatileDataset();

            Mock <IErrorsReportingService> mockService = new Mock <IErrorsReportingService>();

            mockService.Setup(s => s.GetApplication(It.IsAny <string>(), It.IsAny <string>()))
            .Returns <string, string>((name, version) => store.Applications.Single(a => a.Name == name && a.Version == version));

            IErrorsReportingService service     = mockService.Object;
            ErrorReportApplication  application = service.GetApplication("TestApplicationAlreadyExisting", "1.0.0.0");

            Assert.AreEqual(1, application.Id);
            Assert.AreEqual(new DateTime(2000, 1, 1), application.FirstRunDate);
        }
        public void GetApplication_NotExisting()
        {
            VolatileDataset store = new VolatileDataset();

            Mock <IErrorsReportingService> mockService = new Mock <IErrorsReportingService>();

            mockService.Setup(s => s.GetApplication(It.IsNotIn <string>(store.Applications.Select(a => a.Name)), It.IsAny <string>()))
            .Returns <string, string>(null);

            IErrorsReportingService service = mockService.Object;

            ErrorReportApplication application = null;

            Assert.That(() =>
            {
                application = service.GetApplication("TestApplicationNotExisting", "1.0.0.0");
            }, Throws.Nothing);

            Assert.IsNull(application);
        }