Esempio n. 1
0
        public void GetAllRegistered_ReturnsExpectedCollection_WhenRegisterSeveralEntities()
        {
            //arrange
            var testString    = "TEST";
            var expectedCount = 2;

            //action
            _container.Register <TestA, TestB>();
            _container.Register <TestA, TestB1>(() => new TestB1("TEST"));
            var instancesCollection = _container.GetAllRegistered <TestA>().ToList();

            //assert
            Assert.AreEqual(expectedCount, instancesCollection.Count);
            Assert.IsInstanceOf <TestB>(instancesCollection[0]);
            Assert.IsInstanceOf <TestB1>(instancesCollection[1]);
            Assert.AreEqual(testString, ((TestB1)instancesCollection[1]).Value);
        }