public void TestInit()
        {
            _container = new UnityAutoMoqContainer();
            _container.RegisterType <ICsvMapping <IncrementalClaimData>, CsvIncrementalClaimDataMapping>();
            _container.RegisterType <IIncrementalDataFileParser, IncrementalDataFileParser>();

            _sut = _container.Resolve <CumulativeClaim>();
        }
        public void Can_get_registered_implementation()
        {
            container.RegisterType <IAnotherService, AnotherService>();
            var real = container.Resolve <IAnotherService>();

            real.ShouldBeOfType <AnotherService>();
        }
        public void Can_get_registered_implementation()
        {
            _container.RegisterType <IAnotherService, AnotherService>();
            var real = _container.Resolve <IAnotherService>();

            Assert.IsAssignableFrom <AnotherService>(real);
        }
예제 #4
0
        private static IVotingProcessService GetScrutinService()
        {
            var container = new UnityAutoMoqContainer();

            container.RegisterType <IVotingProcessService, ScrutinService>();
            container.RegisterType <ICalculateurFactory, CalculatorFactory>();
            container.RegisterType <IMapperService, MapperService>();

            var repoMock = container.GetMock <IVotingProcessRepository>();

            repoMock.Setup(m => m.GetVotingProcess())
            .Returns(ScrutinsParNom.Values.AsQueryable());

            var resultatRepoMock = container.GetMock <IRepository <Result> >();

            resultatRepoMock.Setup(m => m.Add(It.IsAny <Result>()))
            .Callback((Result resultat) => ScenarioContext.Current["ResultatBdd"] = resultat);

            resultatRepoMock.Setup(r => r.GetAll("", null))
            .Returns(() => new[] { ScenarioContext.Current["ResultatBdd"] as Result }.AsQueryable());

            return(container.Resolve <IVotingProcessService>());
        }