Beispiel #1
0
        public void CanProcess_should_be_false()
        {
            var handler = new DynamicLocalizationAttributeHandler();
            var args    = new AttributeHandlersArgs(new AutoRefreshLocalizationAttribute(), null, null, null);

            handler.CanProcess(args).Should().Be(false);
        }
        public void CanProcess_should_be_true()
        {
            var handler = new DynamicLocalizationAttributeHandler();
            var args    = new AttributeHandlersArgs(new DynamicLocalizationAttribute("test", "test"), null, null, null);

            handler.CanProcess(args).Should().Be(true);
        }
        public void HasData_should_not_be_true()
        {
            var handler = new DynamicLocalizationAttributeHandler();
            var args    = new AttributeHandlersArgs(new DynamicLocalizationAttribute("test"), null, null, null);

            handler.HasData(args).Should().Be(false);
        }
        public void Data_without_prefix_should_be_empty()
        {
            DISetup.SetupContainer();
            var locManager = new Mock <ILocalizationManager>();

            locManager.Setup(s => s.GetResource(It.Is <string>(s => s == "test"))).Returns("test localization");
            DISetup.Container.RegisterInstance(locManager.Object);
            var invocation = new Mock <Castle.DynamicProxy.IInvocation>();

            invocation.Setup(p => p.InvocationTarget).Returns(new FakeModel()
            {
                DependendProperty = "test2"
            });
            var args    = new AttributeHandlersArgs(new DynamicLocalizationAttribute("DependendProperty"), invocation.Object, null, null);
            var handler = new DynamicLocalizationAttributeHandler();

            handler.GetData(args).Should().BeNull();
        }