예제 #1
0
        public void RequestByNameCallProviderByNameTest()
        {
            string name = VALID_COUNTRY_NAME;

            IPersonAdditionalInfoProvider providerMock = this.GetPersonAdditionalInfoProviderMock();
            ILogger     logger     = this.GetLoggerMocked();
            IMessageBus messageBus = GetMessageBusMocked();
            var         manager    = new PersonAdditionalInfoManagerFake(providerMock, logger, messageBus);

            Country result = manager.GetCountryByName(name);

            Mock.Assert(() => providerMock.GetCountryByName(Arg.AnyString), Occurs.Once());
        }
예제 #2
0
        public void GetCountryByNameInvalidNameTest()
        {
            string name = "abc";

            IPersonAdditionalInfoProvider providerMock = this.GetPersonAdditionalInfoProviderMock();
            ILogger     logger     = this.GetLoggerMocked();
            IMessageBus messageBus = GetMessageBusMocked();
            var         manager    = new PersonAdditionalInfoManagerFake(providerMock, logger, messageBus);

            Country result = manager.GetCountryByName(name);

            Assert.IsNull(result);

            Assert.AreEqual(0, manager.ExposedCountryDictionaryByName.Count);
        }
예제 #3
0
        public void GetCountryByNameTest(string name, string inputName)
        {
            IPersonAdditionalInfoProvider providerMock = this.GetPersonAdditionalInfoProviderMock();
            ILogger     logger     = this.GetLoggerMocked();
            IMessageBus messageBus = GetMessageBusMocked();
            var         manager    = new PersonAdditionalInfoManagerFake(providerMock, logger, messageBus);

            Country result = manager.GetCountryByName(inputName);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Id > 0);
            Assert.AreEqual(name, result.Name);

            Assert.AreEqual(1, manager.ExposedCountryDictionaryByName.Count);
        }
예제 #4
0
        public void GetCountryByNameLowerCaseTest()
        {
            string validName = string.Format(COUNTRY_NAME_TEMPLATE, 3);
            string name      = validName.ToLower();

            IPersonAdditionalInfoProvider providerMock = this.GetPersonAdditionalInfoProviderMock();
            ILogger     logger     = this.GetLoggerMocked();
            IMessageBus messageBus = GetMessageBusMocked();
            var         manager    = new PersonAdditionalInfoManagerFake(providerMock, logger, messageBus);

            Country result = manager.GetCountryByName(name);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Id > 0);
            Assert.AreEqual(validName, result.Name);

            Assert.AreEqual(1, manager.ExposedCountryDictionaryByName.Count);
        }