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()); }
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(); }
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(); }