Exemple #1
0
        public void Handle_WhenPropertyIsChanged_CallsSetProperty()
        {
            string?nameResult  = null;
            string?valueResult = null;
            var    context     = IWorkspaceProjectContextMockFactory.ImplementSetProperty((name, value) => { nameResult = name; valueResult = value; });

            var handler = CreateInstance(context: context);

            var projectChange = IProjectChangeDescriptionFactory.FromJson(
                @"{
    ""Difference"": { 
        ""AnyChanges"": true,
        ""ChangedProperties"": [ ""RootNamespace"" ]
    },
    ""After"": { 
        ""Properties"": {
            ""RootNamespace"": ""value""
        }
    }
}");

            Handle(handler, projectChange);

            Assert.Equal("RootNamespace", nameResult);
            Assert.Equal("value", valueResult);
        }
Exemple #2
0
        public void Handle_WhenPropertyIsNotChanged_DoesNotCallSetProperty(string input)
        {
            int callCount = 0;
            var context   = IWorkspaceProjectContextMockFactory.ImplementSetProperty((name, value) => { callCount++; });

            var handler = CreateInstance(context: context);

            var projectChange = IProjectChangeDescriptionFactory.FromJson(input);

            Handle(handler, projectChange);

            Assert.Equal(0, callCount);
        }
        public void Handle_WhenPropertyIsChanged_CallsSetProperty()
        {
            string?nameResult  = null;
            string?valueResult = null;
            var    context     = IWorkspaceProjectContextMockFactory.ImplementSetProperty((name, value) => { nameResult = name; valueResult = value; });

            var handler = CreateInstance(context: context);

            var projectChange = IProjectChangeDescriptionFactory.FromJson(
                "" "
                {
                    " Difference ": { 
                        " AnyChanges ": true,
                        " ChangedProperties ": [ " RootNamespace " ]