Giter VIP home page Giter VIP logo

Comments (8)

SimeonGerginov avatar SimeonGerginov commented on July 17, 2024

Yes, for the example you have provided:

 public class HostConfigManager
 {
     public HostDateTimeSystem DateTimeSystem { get; set; }
     public ManagedObjectReference NetworkSystem { get; set; }
     public HostServiceSystem ServiceSystem { get; set; }
 }

The three types can easily be replaced with the new type you proposed. The problem I see is that the new type should have the following structure:

 public class ManagedObjectReference : System.IEquatable
 {
     public string Type { get; set; }
     public string Value { get; set; }

     public void UpdateDateTimeConfig(HostDateTimeConfig config)
     {
     }
     
     public void UpdateDnsConfig(HostDnsConfig dnsConfig)
     {
     }

     public void UpdateServicePolicy(string serviceId, string servicePolicyValue)
     {
     }
 }

So potentially this class will become very large, so we think the best solution is to have separate classes.

from dscr-for-vmware.

lucdekens avatar lucdekens commented on July 17, 2024

Why would for example the UpdateDateTimeConfig method, need to be defined on the ManagedObjectReference class?
I would expect it as a method on the HostDateTimeSystem class, just like in the vSphere API.
That would also make the mapping of the TestHelpers to the vSphere API more realistic.

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on July 17, 2024

Sorry, I think I have misunderstood your previous example. With the Type property you can specify the type for example HostDateTimeSystem and with the Value property you will pass the value of the object ?

from dscr-for-vmware.

lucdekens avatar lucdekens commented on July 17, 2024

No, the Type and Value would behave as a regular MoRef.
You use the complete object as a value to the Get-View -Id cmdlet.
That call returns the actual object.

The reason for suggesting this, I can see code that will use this Get-View -Id format to retrieve vSphere objects.
If we implement this in the TestHelper module, I think we can actually cover that part of the code in our tests.
As an example, assume we have a Get-View -Id in a Try-Catch construct.
If the Get-View behaves as a regular Get-View when passed a MoRef, we can for example also test the Catch part (without the need to start using Throws in our mocks).

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on July 17, 2024

Yes this will be a good solution. Do you want to work on it ?

from dscr-for-vmware.

lucdekens avatar lucdekens commented on July 17, 2024

Sure, I'll combine that with #75

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on July 17, 2024

Ok, I am assigning you to the issue.

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on July 17, 2024

Added to the repository via PR #82. Closing the issue.

from dscr-for-vmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.