public void Register__SystemRegistered()
        {
            MockedStateManagementSystemBuilder.Setup(_ => _.ExtractResult()).Returns(StateManagementSystem);

            TestInstance.Register(StateManagementSystemBuilder);

            MockedStateManagementSystemsCatalog.Verify(_ => _.Register(StateManagementSystem));
        }
示例#2
0
 public void Register_AlreadyRegistered_InvalidOperationException()
 {
     Assert.ThrowsException <InvalidOperationException>(() =>
     {
         TestInstance.Register(StateManagementSystem);
         TestInstance.Register(StateManagementSystem);
     });
 }
        public void Register__SystemExtractedAfterBuild()
        {
            var callCounter       = 0;
            var buildCallNumber   = 0;
            var extractCallNumber = 0;

            MockedSystemBuildingDirector.Setup(_ => _.Build(It.IsAny <IStateManagementSystemBuildingOperations>()))
            .Callback(() => buildCallNumber = ++callCounter);
            MockedStateManagementSystemBuilder.Setup(_ => _.ExtractResult())
            .Callback(() => extractCallNumber = ++callCounter);

            TestInstance.Register(StateManagementSystemBuilder);

            Assert.IsTrue(extractCallNumber > buildCallNumber);
        }
        public void Register__SystemBuilt()
        {
            TestInstance.Register(StateManagementSystemBuilder);

            MockedSystemBuildingDirector.Verify(_ => _.Build(StateManagementSystemBuilder));
        }
示例#5
0
        public void Retrieve_Registered_Provided()
        {
            TestInstance.Register(StateManagementSystem);

            Assert.AreSame(StateManagementSystem, TestInstance.Retrieve <IData>());
        }