Ejemplo n.º 1
0
 private static void SetupViewServices()
 {
     ViewServices = new ViewServiceRepository();
     ViewServices.Register <IConfirmationService>(new ConfirmationService());
     ViewServices.Register <IInfoService>(new InfoService());
     ViewServices.Register <IMoveDatabaseService>(new MoveDatabaseService());
     ViewServices.Register <IBrowseFileService>(new BrowseFileService());
     ViewServices.Register <IProgressService>(new ProgressService());
 }
Ejemplo n.º 2
0
        public void ServiceResultIsCasted()
        {
            // Arrange
            var serviceMock = new Mock<IViewService>();
            serviceMock.Setup( s => s.Execute( It.IsAny<MetroWindow>(), It.IsAny<object>() ) ).Returns( Task.FromResult( (object)123 ) );

            IViewServiceRepository repo = new ViewServiceRepository();
            repo.Register<IDummyService>( serviceMock.Object );

            // Act
            int result = repo.Execute<IDummyService, int>().Result;

            // Assert
            Assert.AreEqual( 123, result );
            serviceMock.VerifyAll();
        }
Ejemplo n.º 3
0
        public void ServiceResultIsCasted()
        {
            // Arrange
            var serviceMock = new Mock <IViewService>();

            serviceMock.Setup(s => s.Execute(It.IsAny <MetroWindow>(), It.IsAny <object>())).Returns(Task.FromResult((object)123));

            IViewServiceRepository repo = new ViewServiceRepository();

            repo.Register <IDummyService>(serviceMock.Object);

            // Act
            int result = repo.Execute <IDummyService, int>().Result;

            // Assert
            Assert.AreEqual(123, result);
            serviceMock.VerifyAll();
        }