예제 #1
0
        public void TestInit()
        {
            _container = new UnityAutoMoqContainer();

            _container.RegisterType <ICsvMapping <IncrementalClaimData>, CsvIncrementalClaimDataMapping>();
            _sut = _container.Resolve <IncrementalDataFileParser>();
        }
        public void Should_apply_default_default_value_when_none_specified()
        {
            _container = new UnityAutoMoqContainer();
            var mocked = _container.GetMock <IService>();

            Assert.AreEqual(DefaultValue.Mock, mocked.DefaultValue);
        }
        public void Should_apply_specified_default_value_when_specified()
        {
            container = new UnityAutoMoqContainer(DefaultValue.Empty);
            var mocked = container.GetMock <IService>();

            mocked.DefaultValue.ShouldEqual(DefaultValue.Empty);
        }
        public void Should_apply_specified_default_value_when_specified_2()
        {
            _container = new UnityAutoMoqContainer {
                DefaultValue = DefaultValue.Empty
            };
            var mocked = _container.GetMock <IService>();

            Assert.AreEqual(DefaultValue.Empty, mocked.DefaultValue);
        }
        public void GetStubMethod_ShouldReturn_TheSameMockedInstance()
        {
            _container = new UnityAutoMoqContainer(DefaultValue.Empty);
            var mocked = _container.GetMock <IService>();

            var stub = _container.GetStub <IService>();

            Assert.AreSame(stub.Object, mocked.Object);
        }
예제 #6
0
        public void setUpBase()
        {
            if (!registered)
            {
                var container = new UnityAutoMoqContainer();
                Container = RegisterTypes(container);

                registered = true;
            }
        }
예제 #7
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>());
        }
 public void SetUp()
 {
     container = new UnityAutoMoqContainer();
 }
        public void GetStubMethod_ShouldReturn_TheSameMockedInstance()
        {
            container = new UnityAutoMoqContainer(DefaultValue.Empty);
            var mocked = container.GetMock<IService>();

            var stub = container.GetStub<IService>();

            mocked.Object.ShouldBeSameAs(stub.Object);
        }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UnityAutoMoqExtension"/> class.
 /// </summary>
 /// <param name="autoMoqContainer">The auto moq container.</param>
 public UnityAutoMoqExtension(UnityAutoMoqContainer autoMoqContainer)
 {
     this.autoMoqContainer = autoMoqContainer;
 }
 public static void some_operation_returns_1(SomeClassWithDependencies sut, UnityAutoMoqContainer container)
 {
     container.GetMock<ISomeOtherInterface>().Setup(x => x.SomeOperation()).Returns(1);
 }
 public static void nothing(SomeClassWithDependencies sut, UnityAutoMoqContainer container)
 {
 }
 public static void class_is_initialized(SomeClassWithDependencies sut, UnityAutoMoqContainer container)
 {
     sut.Initialize();
 }
 public NotesPresenterUnitTests()
 {
     _autoMoqContainer = new UnityAutoMoqContainer();
 }
예제 #15
0
 protected abstract UnityAutoMoqContainer RegisterTypes(UnityAutoMoqContainer container);
        public void Should_apply_default_default_value_when_none_specified()
        {
            container = new UnityAutoMoqContainer();
            var mocked = container.GetMock<IService>();

            mocked.DefaultValue.ShouldEqual(DefaultValue.Mock);
        }
 public void SetUp()
 {
     container = new UnityAutoMoqContainer();
 }
 public NotesPresenterUnitTests()
 {
     _autoMoqContainer = new UnityAutoMoqContainer();
 }
 public void SetUp()
 {
     AutoMock = new UnityAutoMoqContainer();
     Setup();
 }
        public void Should_apply_specified_default_value_when_specified_2()
        {
            container = new UnityAutoMoqContainer{DefaultValue = DefaultValue.Empty};
            var mocked = container.GetMock<IService>();

            mocked.DefaultValue.ShouldEqual(DefaultValue.Empty);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UnityAutoMoqBuilderStrategy"/> class.
 /// </summary>
 /// <param name="autoMoqContainer">The auto moq container.</param>
 public UnityAutoMoqBuilderStrategy(UnityAutoMoqContainer autoMoqContainer)
 {
     this.autoMoqContainer = autoMoqContainer;
     mocks = new Dictionary<Type, object>();
 }