コード例 #1
0
        public void GetSimpleService()
        {
            _registration.AddComponent("MyTestComponent")
            .AddService <TestServiceDefaultCtor>();

            _serviceManager.Load();

            var instance1 = _serviceManager.Get <TestServiceDefaultCtor>();

            Assert.That(instance1, Is.TypeOf <TestServiceDefaultCtor>());
            var instance2 = _serviceManager.Get <TestServiceDefaultCtor>();

            Assert.That(instance2, Is.TypeOf <TestServiceDefaultCtor>());
            Assert.That(instance1, Is.Not.EqualTo(instance2));
        }
コード例 #2
0
        public void AddComponent()
        {
            const string ComponentName      = "MyTestComponent";
            const string ComponentCopyright = "Copyright bla";

            var componentInfoWrapper = _registration.AddComponent(ComponentName, ComponentCopyright);

            Assert.That(_registration.ComponentInfos.ContainsKey(ComponentName));
            var componentInfo = _registration.ComponentInfos[ComponentName];

            Assert.That(componentInfo.Name == ComponentName);

            Assert.That(object.ReferenceEquals(componentInfo, componentInfoWrapper.ComponentInfo));
        }