rubberduck-vba / MVVM

Model-View-ViewModel Infrastructure for VBA/VB6
MIT License
56 stars 15 forks source link

Binding manager tests failing on initialize and on the handle property change tests #15

Open ATECoder opened 1 year ago

ATECoder commented 1 year ago

Thank you for this interesting project. I am trying to see if I can use this to implement a bit of MVVM in Excel. I saw your indication that this is super experimental.

I am getting a type mismatch error on this statement:

Set Test.ConcreteSUT = BindingManager.Create(Test.CommandManager, New StringFormatterNetFactory)

which I changed to:

Set Test.ConcreteSUT = BindingManager.Create(AppContext.Create(DebugOutput:=True), New StringFormatterNetFactory)

I am wondering if this change is insufficient and thus causing the handle property change tests to see 0 invokes.

Could you please suggest some ideas of how I could fix this?

Thanks

David

Greedquest commented 1 year ago

I have used the mvvm library successfully - e.g.:

https://codereview.stackexchange.com/q/265793/146810

So I'm wondering if it is an essential part that is not working, or are you trying to run the unit tests which I guess are an added bonus

What I'm getting at is maybe you can ignore this error and everything will still work?

Edit: just noticed my code review post was closed from inactivity :'( here is the example workbook where I have things working https://github.com/Greedquest/CodeReviewFiles/blob/master/MVVM_Comparer.xlsm

Greedquest commented 1 year ago

image

Ah I see you are running the unit tests and seeing this. I'm confused because AppContext.Create needs the IBindingManager, and BindingManager.Create needs the IAppContext. Looking at it I cannot work out how to disentangle.

ATECoder commented 1 year ago

@greedquest,

Indeed, I can run the examples and would be interested in seeing more, which is a secondary advantage of the unit tests. Unfortunately the link to your code review is broken.

To this end I forked the project and split off the API, demo, and tests from the mvvm library and removed the dependencies on .net and the addin.

I was hoping to put together additional examples particularly for binding to spreadsheet-hosted activex controls. Once those and the unit tests work, I might have sufficient confidence in getting mvvm into production code.

David


From: Greedquest @.> Sent: Friday, August 4, 2023 2:45:45 PM To: rubberduck-vba/MVVM @.> Cc: David Hary @.>; Author @.> Subject: Re: [rubberduck-vba/MVVM] Binding manager tests failing on initialize and on the handle property change tests (Issue #15)

[image]https://user-images.githubusercontent.com/25348920/258534136-0a637cf9-6133-4efa-8961-666e6769b338.png

Ah I see you are running the unit tests and seeing this. I'm confused because AppContext.Create needs the IBindingManager, and BindingManager.Create needs the IAppContext. Looking at it I cannot work out how to disentangle.

— Reply to this email directly, view it on GitHubhttps://github.com/rubberduck-vba/MVVM/issues/15#issuecomment-1666210263, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAGBGSQ5AV45V6U7QG4CR5DXTVUQTANCNFSM6AAAAAA3EUE6GQ. You are receiving this because you authored the thread.Message ID: @.***>

Greedquest commented 1 year ago

Well for what it's worth the plan as I understand it is to reimplement this framework in twinBASIC as a compiled dll which you would then reference from VBA. The tests will likely have to be partly rewritten at that point - so I doubt you will see them fixed in the VBA form.

Sorry about the broken code review post. It points to this spreadsheet Greedquest/CodeReviewFiles@master/MVVM_Comparer.xlsm where I have used MVVM to implement a userform that allows you to sort a list by selecting between 2 items (i.e. which is "greater" than the other)

image

It's just another demo to show how to use MVVM in practice. Very simple use case. I can resurrect the code from the CR post but it sounds like you have made some progress of your own so I don't know how useful you'll find it.

ATECoder commented 1 year ago

Cool. Thanks. I got the example and will take a look at it.

Is there a twinBasic MVVM project on GitHub that I can follow?

From: @.> Sent: Friday, August 4, 2023 15:20 To: @.> Cc: David @.>; @.> Subject: Re: [rubberduck-vba/MVVM] Binding manager tests failing on initialize and on the handle property change tests (Issue #15)

Well for what it's worth the plan as I understand it is to reimplement this framework in twinBASIC as a compiled dll which you would then reference from VBA. The tests will likely have to be partly rewritten at that point - so I doubt you will see them fixed in the VBA form.

Sorry about the broken code review post. It points to this spreadsheet @.***/MVVM_Comparer.xlsmhttps://github.com/Greedquest/CodeReviewFiles/blob/master/MVVM_Comparer.xlsm?rgh-link-date=2023-08-04T21%3A09%3A00Z where I have used MVVM to implement a userform that allows you to sort a list by selecting between 2 items (i.e. which is "greater" than the other)

[image]https://user-images.githubusercontent.com/25348920/258540167-ed717f85-3e3e-4c39-9bb7-a3dca1a7c48d.png

It's just another demo to show how to use MVVM in practice. Very simple use case. I can resurrect the code from the CR post but it sounds like you have made some progress of your own so I don't know how useful you'll find it.

— Reply to this email directly, view it on GitHubhttps://github.com/rubberduck-vba/MVVM/issues/15#issuecomment-1666232920, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAGBGSXQ7YFTV6C43XEB2LTXTVYRZANCNFSM6AAAAAA3EUE6GQ. You are receiving this because you authored the thread.Message ID: @.***>