예제 #1
0
        public void ShouldAllowLoadToBeInvokedTwice()
        {
            var catalog = new TestableModuleCatalog();

            var testableCatalog = new TestableModuleCatalog();

            testableCatalog.Load();
            Assert.AreEqual <int>(1, testableCatalog.LoadCalledCount);
            testableCatalog.Load();
            Assert.AreEqual <int>(2, testableCatalog.LoadCalledCount);
        }
예제 #2
0
        public void ShouldNotLoadAgainDuringInitialize()
        {
            var catalog = new TestableModuleCatalog();

            var testableCatalog = new TestableModuleCatalog();

            Assert.IsFalse(testableCatalog.LoadCalled);
            Assert.IsFalse(testableCatalog.ValidateCalled);

            testableCatalog.Load();
            Assert.AreEqual <int>(1, testableCatalog.LoadCalledCount);
            testableCatalog.Initialize();
            Assert.AreEqual <int>(1, testableCatalog.LoadCalledCount);
        }
예제 #3
0
        public void ShouldNotLoadAgainIfInitializedCalledMoreThanOnce()
        {
            var catalog = new TestableModuleCatalog();

            var testableCatalog = new TestableModuleCatalog();

            Assert.False(testableCatalog.LoadCalled);
            Assert.False(testableCatalog.ValidateCalled);

            testableCatalog.Initialize();
            Assert.Equal <int>(1, testableCatalog.LoadCalledCount);
            testableCatalog.Initialize();
            Assert.Equal <int>(1, testableCatalog.LoadCalledCount);
        }
예제 #4
0
        public void ShouldLoadAndValidateOnInitialize()
        {
            var catalog = new TestableModuleCatalog();

            var testableCatalog = new TestableModuleCatalog();

            Assert.IsFalse(testableCatalog.LoadCalled);
            Assert.IsFalse(testableCatalog.ValidateCalled);

            testableCatalog.Initialize();
            Assert.IsTrue(testableCatalog.LoadCalled);
            Assert.IsTrue(testableCatalog.ValidateCalled);
            Assert.IsTrue(testableCatalog.LoadCalledFirst);
        }
예제 #5
0
        public void ShouldRevalidateWhenAddingNewModuleIfValidated()
        {
            var testableCatalog = new TestableModuleCatalog();

            testableCatalog.Items.Add(new ModuleInfoGroup()
            {
                CreateModuleInfo("ModuleA")
            });
            testableCatalog.Validate();
            testableCatalog.Items.Add(new ModuleInfoGroup()
            {
                CreateModuleInfo("ModuleB")
            });
            Assert.IsTrue(testableCatalog.ValidateCalled);
        }
예제 #6
0
        public void ShouldAllowLoadToBeInvokedTwice()
        {
            var catalog = new TestableModuleCatalog();

            var testableCatalog = new TestableModuleCatalog();
            testableCatalog.Load();
            Assert.AreEqual<int>(1, testableCatalog.LoadCalledCount);
            testableCatalog.Load();
            Assert.AreEqual<int>(2, testableCatalog.LoadCalledCount);
        }
예제 #7
0
        public void ShouldNotLoadAgainDuringInitialize()
        {
            var catalog = new TestableModuleCatalog();

            var testableCatalog = new TestableModuleCatalog();
            Assert.IsFalse(testableCatalog.LoadCalled);
            Assert.IsFalse(testableCatalog.ValidateCalled);

            testableCatalog.Load();
            Assert.AreEqual<int>(1, testableCatalog.LoadCalledCount);
            testableCatalog.Initialize();
            Assert.AreEqual<int>(1, testableCatalog.LoadCalledCount);
        }
예제 #8
0
        public void ShouldLoadAndValidateOnInitialize()
        {
            var catalog = new TestableModuleCatalog();

            var testableCatalog = new TestableModuleCatalog();
            Assert.IsFalse(testableCatalog.LoadCalled);
            Assert.IsFalse(testableCatalog.ValidateCalled);

            testableCatalog.Initialize();
            Assert.IsTrue(testableCatalog.LoadCalled);
            Assert.IsTrue(testableCatalog.ValidateCalled);
            Assert.IsTrue(testableCatalog.LoadCalledFirst);
        }
예제 #9
0
 public void ShouldRevalidateWhenAddingNewModuleIfValidated()
 {
     var testableCatalog = new TestableModuleCatalog();
     testableCatalog.Items.Add(new ModuleInfoGroup() { CreateModuleInfo("ModuleA") });
     testableCatalog.Validate();
     testableCatalog.Items.Add(new ModuleInfoGroup() { CreateModuleInfo("ModuleB") });
     Assert.IsTrue(testableCatalog.ValidateCalled);
 }