diff --git a/LinqToUmbraco/dep/Imagery/umbraco.ico b/LinqToUmbraco/dep/Imagery/umbraco.ico new file mode 100644 index 0000000000..402cf9594e Binary files /dev/null and b/LinqToUmbraco/dep/Imagery/umbraco.ico differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Mocking/Rhino.Mocks.dll b/LinqToUmbraco/dep/Reference Assemblies/Mocking/Rhino.Mocks.dll new file mode 100644 index 0000000000..4b6904b6f8 Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Mocking/Rhino.Mocks.dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Mocking/TypeMock.XML b/LinqToUmbraco/dep/Reference Assemblies/Mocking/TypeMock.XML new file mode 100644 index 0000000000..e7e8a49a4a --- /dev/null +++ b/LinqToUmbraco/dep/Reference Assemblies/Mocking/TypeMock.XML @@ -0,0 +1,10587 @@ + + + + TypeMock + + + + + Implement the logic which activate the decorating attributes. + + + + + holds the Decorated method (i.e. method which is tagged by the custom attribute) + + + + + stores the instance that the decorated method was called with + + + + + stores the original parameters to pass to the decorated method + + + + + holds all the attributes decorating the method + + + + + specify if the original method was called or not during the execution flow + + + + + specify if the original method can be ignored + + + + + default ctor. initialize the context,method,attributes,par + + The method to decorate(i.e. the method which is tagged by the attribute) + The instance that the decorated method was called through + the parameters to pass to the decorated method + + + + Returns all the custom attributes (i.e. sub classes of DecoratorAttribute) that surrounds the method + + The method + array of the decorating attributes + + + + Activate the execution flow of the decorating attributes + + The results from activating the original invoker on the test (unless overridden) + + + + Tell the decorator not to check if the decorated method was called from the + attributes. this means that if the attribute didnt call the decorated method + it wont be executed at all. + + + + + Retrieves the Original method info (the method which is tagged by the attribute) + + + + + Retrieves the instance that the original method was called with. + + + + + Retrieves the original parameters that were passed to the original method + + + + + Use this type when mocking global functions + + + This is an example of how to mock global functions in C++ + + + namespace TestWithCpp + { + int globalFunction(int a) {return a;} + } + + And the test + + [Test] + void Global() { + Mock* mock = MockManager::Mock(__typeof(GlobalType)); + mock->ExpectAndReturn("TestWithCpp.globalFunction",__box(5)); + Assert::AreEqual(__box(5), __box(globalFunction(4))); + } + + + + + + + Hold the Return value for mocked methods + + + + + Typemock Isolator can validates parameter values, collections and arrays. + To do so just pass the list of expected parameter values to the Args + method. + + + It is possible to check that a mocked method has been called with specific + argument values. + + + For example, if we need to check that an int parameter is 10 + we can write the following code + + [Test] + public void Test() + { + // Start mocking TestedClass + Mock mock = MockManager.Mock(typeof(TestedClass)); + // first time passInt will be called, arguments must be 10 + mock.ExpectCall("passInt").Args(10); + // second time 1 + mock.ExpectCall("passInt").Args(1); + TestedClass t = new TestedClass(); + // This will pass + t.passInt(10); + // This will fail + t.passInt(3); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub Test() + ' Start mocking TestedClass + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + ' first time passInt will be called, arguments must be 10 + mock.ExpectCall("passInt").Args(10) + ' second time 1 + mock.ExpectCall("passInt").Args(1) + Dim t As TestedClass = New TestedClass + ' This will pass + t.passInt(10) + ' This will fail + t.passInt(3) + MockManager.Verify() + End Sub + + + + Single Dimension Arrays and Collections are iterated and checked for match of all items + See for built in ParameterCheckers + See for details of user defined checks + + + BEWARE, Typemock Isolator normally check the type of return value with the existing + method, but it does not check the legitimacy of the returned value in case of + overloaded methods that have different return types, (as Typemock Isolator sees these + as one mocked method) if you return a value with the wrong type a + System.InvalidCastException will be thrown + + + Typemock Isolator supports checking methods with up to 30 parameters + + + This Interface is not to be implemented by client + + + + + + + + Set the list of expected parameters + + + + list of expected parameters and/or parameter checkers + Will be throw if more then 30 parameters are used + + + + Conditional mock, + Set the list of parameters, only if these parameters are passed, is the mocked invoked + *Enterprise version Only* + + + + list of condition parameters and/or parameter checkers + Will be throw if more then 30 parameters are used + + + + Parameter Checks for mocked Property set methods + + + See and + + + + + This Interface is not to be implemented by client + + + + + + Set expected set value + + + + + expected value + + + + Conditional mock, + Set the list of parameters, only if these parameters are passed, is the mocked invoked + *Enterprise version Only* + + + + + conditional value + + + + Parameter Checks for mocked Index set methods + + + See and + + + + + This Interface is not to be implemented by client + + + + + + Set expected index number + + + + + expected index + expected set value + + + + Conditional mock, + Set the list of parameters, only if these parameters are passed, is the mocked invoked + *Enterprise version Only* + + + + + conditional index + conditional set value + + + + Parameter Checks for mocked Index get methods + + + See and + + + + + This Interface is not to be implemented by client + + + + + + Set expected index number + + + + + expected index + + + + Conditional mock, + Set the list of parameters, only if these parameters are passed, is the mocked invoked + *Enterprise version Only* + + + + + conditional index + + + + set the number of times that the expectation should be repeated + + times to repeat + + + + this takes a regular/conditional expectation and turn it into a default regular/conditional + (repeated always) expectation. + + + + + this takes a default regular/conditional expectation and turn it into a normal one. + + + + + check that the actual arguments passed to the call match the expected, and assign new values + if needed. method will throw a VerifyException if arguments do not match. + + the real parameters passed to the call + the mocked type (needed for error messages) + + + + this just check if actual paramaters passed to the method match the expected ones + (needed to decide if the method should be mocked or not) + + actual parameters passed to the call + the mocked type (needed for error messages) + true if condition is satisfied + + + + + The reliability interface provides automatic (in case of a thread interrup as happens on see cref="IRunnable.Stop()") and manual dumping. + + + + Copy all data hold by the structure to the local dump container and clears the structure. + A structure is invalid and no longer usable after dumping. You should notify all the other threads/processes before dumping. + + + True if there's any data in the dump container. + + + The dump container data structure + + + + Summary description for About. + + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + Change the default Behavior of Natural Mocks™ + + + The default Behavior of Natural Mocks is + + Repeat once (See ) + Ignore Arguments (See ) + + To change this use DefaultBehavior. + This is useful for chained natural mocks where we require the whole chain to be checked. + + + Example of using Natural Mocks™ repeat always, + we will always return 10 when GetSomething().DoSomething() is called from any TestedClass instance + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // make all future instances mocked and all statements repeat + recorder.DefaultBehavior.RepeatAlways(); + // Mock (all) new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // DoSomething to be mocked. + mockedTestedClass.GetSomething().DoSomething(); + // always return 10 + recorder.Return(10); + } + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' make all future instances mocked and all statements repeat + recorder.DefaultBehavior.RepeatAlways() + ' Mock (all) new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be mocked. + mockedTestedClass.GetSomething().DoSomething() + ' always return 10 + recorder.Return(10) + End Using + End Sub + + For VB .NET 1.1 see + + + + + + + + Check All Arguments of statements + + + Using CheckArguments will fail tests if the arguments actually passed are not those that where expected. + Special care must be taken when changing the default expectation, as the statement CheckArguments now + must include an item for all arguments passed. + + + Example of using Natural Mocks™ CheckArguments with multiple statements, + we will validate that GetSomething("TypeMock").DoSomething("magic") is called with "TypeMock" and "magic" + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + recorder.DefaultBehavior.CheckArguments(); + // Mock (all) new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // DoSomething to be mocked. + mockedTestedClass.GetSomething("TypeMock").DoSomething("magic"); + } + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + recorder.DefaultBehavior.CheckArguments() + ' Mock (all) new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be mocked. + mockedTestedClass.GetSomething("TypeMock").DoSomething("magic") + End Using + End Sub + + For VB .NET 1.1 see + + + Example of using Natural Mocks™ CheckArguments with multiple statements, + we will validate the arguments with built-in checks + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + recorder.DefaultBehavior.CheckArguments(); + // Mock (all) new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // DoSomething to be mocked. + mockedTestedClass.GetSomething(null).DoSomething(null); + recorder.CheckArguments(Check.IsIn("TypeMock", "NaturalMock"),Check.StartsWith("s")); + } + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + recorder.DefaultBehavior.CheckArguments() + ' Mock (all) new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be mocked. + mockedTestedClass.GetSomething(null).DoSomething(null); + recorder.CheckArguments(Check.IsIn("TypeMock","NaturalMock"),Check.StartsWith("s")) + End Using + End Sub + + For VB .NET 1.1 see + + + + + + + + Mock method only when arguments passed are as expected + + + See + Care should be taken when using this in a chained statement. + There is no backtracking and after one method is mocked a mock is returned even if the next statement + is not mocked. + + + + + + + Don't verify arguments, this is the default. + + + + + + + + Repeat each statement. + + See + + Amount of times to repeat the expectation + Use to change more Behavior + + + + Repeat each statement for every call. + + See + + Use to change more Behavior + + + + Flags that define the behavior of Arbitrary (not expected) calls. + The default is the Methods of Abstract and Interfaces are Strict and Arbitrary calls fail + while Arbitrary Methods of concrete classes are allowed. + + + When testing for mock interactions there are times when the default behavior needs to be changed, + the StrictFlags define which arbitrary methods we allow. + + When allowing arbitrary abstract methods (methods created dynamically by Typemock Isolator using or ), + Typemock Isolator create the following default behavior: + 1. All void calls just return + 2. Other Methods will return 0 or null depending on the return type + 3. Properties will behave like normal properties + + To set only one method to strict use: or + + + + + + Flags that define the behavior of Field handling calls. + By default internal fields are mocked according to the state of the appropriate + constructor(i.e. if the constructor is mocked then the field will be mocked as well), + which means that any uninitialized field (its value is null) will be replaced with a mocked + object during the recording phase. + values of static fields will be reverted back at the end of the test before any calls to + a method on the class. + + + only the immediate level of fields is automatically mocked. i.e. fields of fields are not mocked. + + + + + Flags that define the default behavior of static constructors mocking. + By default all static constructors of objects created inside a recording block will + not be mocked. + Setting this flag to true will cause static constructors of newly created object to be mocked. + (the real static constructor will be executed when needed after the test ends.) + + + + Used to clean up the defined expectations on MockManager at the end of + each test. This class cant be inherited. + Any method marks with this attribute will clean all set expectation + after the test is done. A marked class will do this for any test defined in + it. + + + [TestFixture] + [ClearMocks] // clear all mocks between tests + public TestClass + { + [Test] + public void MyTest1() + { + // the test code + } + } + + + < TestFixture >_ + < ClearMocks >_ ' clear all mocks between tests + Public class TestClass + < Test >_ + Public Sub MyTest1() + ' the test code + End Sub + End Class + + + VerifyMocksAttribute + + + + This is the base class for all decorator attributes. + In order to implement a custom attribute, need to subclass DecoratorAttribute and implement the + abstract method execute. + + + The custom attribute can control the flow of the call to the original method by + calling the CallOriginalMethod method during the execute method. + In any case even if the original method is not activated by the custom attribute it will be run by the decorator + framework + + + + + Referance to the decorator object which holds data of the original method + + + + + The method that is decorated by the attribute. + + + + + The propriety logic of the attribute should be implemented in the execute. The + custom attribute can control the flow of the call to the original method by calling + the CallOriginalMethod method during the execute method. In any case even if the + original method is not activated by the custom attribute it will be run by the + decorator framework, unless the attribute specifically asked that the original + method will not be called using the + DontCallDecoratedMethod Method + + The results from activating the original invoker on the test (unless overridden) + + + + Replace the call to the original method with the call to the attribute execute, storing all needed information + + The MethodDecorator instance which holds the original method data + The method that needs to be decorated + ExecutionDelegator representing the method after decoration + + + + Filter which methods to Execute the code, when the attribute is on a Class + + method being executed + true to wrap the code + Default action is to apply class decorators only on test methods + i.e. methods that are decorated with [Test] or [TestMethod] attribute on them as well + + + + Activate the original (decorated) method. + + The results from activating the original method + + + + Stops the decorator from calling the original method which is called automatically + even when Execute method fails to call + CallDecoratedMethod. + + If original method is decorated by another attribute and + explicitly called there. It will be + activated + + + + Retrieves the Original method info (the method which is tagged by the attribute) + + + + + Retrieves the instance that the original method was called with. + + + + + Retrieves the original parameters that were passed to the original method + + + + + Called by the framework instead of the original method. This will run the original method and + afterwards clear the Mock Manager. + + the result of the original method + + + + Typemock Isolator Natural Mocks™ RecorderManager class helps manage the mocks + + + + Typemock Isolator supports the innovative Natural Mocks™ way of defining expectations by recording the expectations. + Natural Mocks™ are Strongly Typed and thus supports Compile Time Checks and Refactoring. + Using Natural Mocks™ it is now much simpler to define and create tests that require isolating other parts of the code. Although the Natural Mocks™ is easier, it does not cover all the scenarios, and the normal TyepMock.NET way is required. The two way are compatible and can be used together. + + See for examples + + + + + + Start a new recording, CAUTION, as long as the recording object is alive ALL methods will be recorded and not called + + + See for usage + + CAUTION, as long as the recording object is alive ALL methods will be recorded and not called + + RecordExpectations object + + + + Stop the recording + + + + + Get the last recorded mock and use Reflective Typemock Isolator methods. + + The mock + + + + Returns the object of the last recorded mock or null if non exists + + a mocked object + + + + Returns the mock associated with a specific instance + + Type of the instance being mocked + The instance to get the mock of + If a Mock is associated with the provided instance, returns it. Otherwise, returns null + + Identify a specific mock when using Natural Mocks + + [Test] + public void GetMockOfSpecificInstance() + { + using(RecordExpectations rec = RecorderManager.StartRecording()) + { + TestClass instance1 = new TestClass(); + TestClass instance2 = new TestClass(); + TestClass instance3 = new TestClass(); + + Mock mock2 = RecorderManager.GetMockOf(instance2); + mock2.ExpectAndReturn("SomeMethod", null); + } + } + + + + + + Create a mocked object + + The type to mock + a mocked object of the type specified + + + + Example of using Natural Mocks™ Return + + [Test] + public void Test() + { + // Create Mock Object + ITestClass mockTestClass = RecorderManager.CreateMockedObject(typeof(ITestClass)) as ITestClass; + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // Set expectations on mocked object. + recorder.ExpectAndReturn(mockTestClass.MyMethod().MyProperty, 5); + } + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Create Mock Object + Dim mockTestClass As ITestClass = RecorderManager.CreateMockedObject(GetType(ITestClass)) + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' Set expectations on mocked object. + recorder.ExpectAndReturn(mockTestClass.MyMethod().MyProperty, 5) + End Using + End Sub + + For VB .NET 1.1 see + + + + + + + Create a mocked object and define constructor Behavior + + The type to mock + Define what constructors to mock + a mocked object of the type specified + + + + Create a mocked object and define constructor Behavior + + The type to mock + Define what constructors to mock + Define Arbitrary Call behavior + a mocked object of the type specified + + + + Create a mocked object, define constructor Behavior and pass arguments to constructor + + The type to mock + Define what constructors to mock + Arguments to pass to constructor + a mocked object of the type specified + + + + Create a mocked object, define constructor Behavior and pass arguments to constructor + + The type to mock + Define Arbitrary Call behavior + Arguments to pass to constructor + a mocked object of the type specified + + + + Create a mocked object, define constructor Behavior and pass arguments to constructor + + The type to mock + Define what constructors to mock + Define Arbitrary Call behavior + Arguments to pass to constructor + a mocked object of the type specified + + + + Create an instance of TMockedType and mock calls made on the instance + + The Type to Mock + The Mocked Instance + + The Constructor will be mocked!. + + Typemock Isolator will choose a constructor with the highest visibility and create default values for the + arguments, to send specific arguments use + + + + [Test] + public void MockTestedClass() + { + TestedClass mockedInstance = RecorderManager.CreateMockedObject<TestedClass>(); + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + mockedInstance.SomeMethod(10); // SomeMethod will be mocked. + } + + mockedInstance.SomeMethod(); // the method is not called + + MockManager.Verify(); // Make sure that all expected calls where made + } + + + <Test()> _ + Public Sub MockTestedClass() + Dim mockedInstance As TestedClass = RecorderManager.CreateMockedObject(Of TestedClass) + ' Start mocking + Using recorder As New RecordExpectations + TestedClass.SomeMethod(10) ' SomeMethod will be mocked. + End Using + + mockedInstance.SomeMethod() ' the method is not called + + MockManager.Verify() ' Make sure that all expected calls where made + End Sub + + + + + + + + Create an instance of TMockedType and mock calls made on the instance, send Constructor behavior and optional arguments + + The Type to Mock + Scope of mocked constructors + Argument for constructor of concrete types, this is ignored for interfaces + The Mocked Instance + + For an example see + + + + + + Create an instance of TMockedType and mock calls made on the instance, send Constructor behavior Strictness and optional arguments + + The Type to Mock + Scope of mocked constructors + Define Arbitrary Call behavior + Argument for constructor of concrete types, this is ignored for interfaces + The Mocked Instance + + For an example see + + + + + + Create an instance of TMockedType and mock calls made on the instance, send Strictness and optional arguments + + The Type to Mock + Define Arbitrary Call behavior + Argument for constructor of concrete types, this is ignored for interfaces + The Mocked Instance + + The Constructor will not be mocked!. + For an example see + + + + + + Get or Set the VerifyMode of the next expectations + + + + + Retrieve the last Mocked Event + + + + + + Summary description for IsCloseCheck. + + + + + Helper for building failure messages + + + + + Create a Message Builder + + Custom message + Arguments for custom message + + + + Add message to prefix, remember current prefix + + Message to add + + + + Restore prefix to last known + + + + + Set message with one text + + Information about the checked argument + Error Message + + + + Set message with expected and actual objects + + Information about the checked argument + The expected argument + The actual argument + + + + Set message with prefix string and expected and actual objects + + Information about the checked argument + Prefix to add to message + The expected argument + The actual argument + + + + Get Message string + + The message string + + + + Default message prefix that can be added to the message + + + The message is: Call to [namespace.method] Parameter: [number] + + + + + Display an object as a string + + The object to display + String representation of object + + + + Quote a string + + Text to Quote + Quoted string + + + + Set/Get the CustomMessage + + + + + Set/Get Prefix to add before message + + + + + Get Message String + + + + + + + + + + + + + + + + + + + + + + + + + ProcessChannel is a queued Inter-Process message channel. + Only objects masked with the are allowed to be transfered through this channel. + + All members of this class are thread-safe. + + + + + + + + + + + + + + + + + + + + + Copy all data hold by the structure to the local dump container and clears the structure. + + A structure is invalid and no longer usable after dumping. You should notify all the other threads/processes before dumping. + + + + + + + + True if there's any data in the dump container. + + + + + The dump container data structure + + + + + + A channel is a queued but blocking message channel. + Channels are useful for Inter-Thread or Inter-Process communication, depending on the implementation. + Usually all interfaces members of this type are thread-safe. + + + + Send a message to the channel with unlimited timeout. + The object to send. There may be limitations on the kind of objects allowed - e.g. to be masked with the SerializedAttribute. + + + Send a message to the channel with limited timeout. + The object to send. There may be limitations on the kind of objects allowed - e.g. to be masked with the SerializedAttribute. + The maximum blocking time. Usually an Exceptions is thrown if a timeout exceeds. + + + Receive a message from the channel with unlimited timeout. + The received object. + + + Receive a message from the channel with limited timeout. + The maximum blocking time. Usually an Exceptions is thrown if a timeout exceeds. + The received object. + + + + Instanciates an Inter-Process message channel. + + The count of messages the channel can queue before it blocks. + The channel's name. Must be the same for all instances using this channel. + The maximum serialized message size in terms of bytes. Must be the same for all instances using this channel. + + + + Send a message to the channel with unlimited timeout. + + The object to send. Only objects masked with the are allowed to be transfered through this channel. + This member is thread-safe. + + + + Send a message to the channel with unlimited timeout. + + The object to send. Only objects masked with the are allowed to be transfered through this channel. + The maximum blocking time. A SemaphorFailedException is thrown if a timout exceeds. + This member is thread-safe. + + + + Receive a message from the channel with unlimited timeout. + + The received object. + This member is thread safe. + + + + Receive a message from the channel with limited timeout. + + The maximum blocking time. A SemaphorFailedException is thrown if a timout exceeds. + The received object. + This member is thread safe. + + + + + + + + + Don't forget to dispose this object before destruction. + + + + + MockObject is the Typemock Isolator dynamic mock object controller, this class is use for managing the + dynamic mocks + + + Mock object have 3 stages. + + + Set Up - This is the stage where you 'record' what the mocked type/object expects + to do and what to return + + + Run - Run the actual class under test + + + Verify - Make sure that the mocked object acted as expected + + + + These phases are managed by the Mock object. + + You cannot create a MockObject directly use MockManager. + + + You can create a mock object from abstract classes and interfaces. + Typemock Isolator will dynamically create a new concrete Type that implements the abstract methods and will + return an instance of the derived type when the is called. + When creating a mock object of a concrete type, Typemock Isolator will create an instance of that type, + and return the instance when the is called. + This way you can mock sealed classes too. + When mocking a method that is declared in a base class, Typemock Isolator will automatically create a mock for the base class + and the mock definitions are propagated to this mock (Strict and MockConstructors). + Note that if a base method is mocked all calls to the method are mocked even though they + are called from derived classes + + + + + + + + + + Mock is the Typemock Isolator mock type controller, this class is use for managing the + virtual mocks + + + Mock object have 3 stages. + + + Set Up - This is the stage where you 'record' what the mocked type/object expects + to do and what to return + + + Run - Run the actual class under test + + + Verify - Make sure that the mocked object acted as expected + + + + These phases are managed by the Mock object. + + You cannot create a Mock directly use MockManager. + + + You cannot mock Interfaces Classes, Use MockManager. + + When mocking a method that is declared in + When mocking a method that is declared in + a base class, Typemock Isolator will only mock that method when called from the mocked type. + When a base method is mocked and a derived class calls that method, it WON'T be mocked + + + + + + + + + + IMockControl is the Typemock Isolator mock type controller, this interface is use for managing the + virtual mocks + + + Mock object have 3 stages. + + + Set Up - This is the stage where you 'record' what the mocked type/object expects + to do and what to return + + + Run - Run the actual class under test + + + Verify - Make sure that the mocked object acted as expected + + + + These phases are managed by the IMockControl object. + + You cannot create an IMockControl directly use MockManager. or MockManager. + + + When mocking a method that is declared in + a base class, Typemock Isolator will only mock that method when called from the mocked type. + When a base method is mocked and a derived class calls that method, it WON'T be mocked + + + + + + + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler. Properties and + indexes can be tweaked using , + , + and + + + + + + Name of method + Interface to change method Behavior + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler + + Name of Property + + Interface to change method Behavior + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler + + Name of Property + + Interface to change method Behavior + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler + + + Interface to change method Behavior + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler + + + Interface to change method Behavior + + + + Mock Constructor + + + Using ExpectConstructor will enable verifying arguments passed + to the constructor + + Can Check Parameters, see + + + + Mock Constructor + + + Using ExpectConstructor will verify that a constructor has been called and can be used to validate the arguments passed + to the constructor + + Number of times to expect + Can Check Parameters, see + + + + Mock unlimited calls from Constructor + + Can Check Parameters, see + + + + Mock Constructor and throw exception when constructor is called + + + Using ExpectConstructorAndThrow will throw an exception when the constructor + is called + + Mocked Exception + Can Check Parameters, see + + + + Don't Mock Constructor but verify arguments + + + Using MockConstructor will enable verifying arguments passed + to the constructor + + Can Check Parameters, see + + + + Don't Mock Constructor but verify arguments + + + Using MockConstructor will enable verifying arguments passed + to the constructor + + Number of times to expect + Can Check Parameters, see + + + + Verify 1 call from method , continue with method as normal + + + + + Method Name + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method not found or is not void + + + + Verify a number of calls from method , continue with method as normal + + + + + Method Name + Number of times to expect + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method not found or is not void + + + + Expect 1 call from method + + + + + Method Name + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method not found or is not void + + + + Expect a number of calls from method + + + + + Method Name + Number of times to expect the call + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method not found or is not void + + + + Expect 1 call from method, and mock return value + + Method Name + Mocked return value + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found or doesn't return the return value type + + + + + + + + Expect a number of calls from method, and mock return value + + Method Name + Mocked return value + Number of times to expect the call + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found or doesn't return the return value type + + + + + + + + Expect 1 call from method, and mock throwing an exception + + + + + + Method Name + Mocked Exception + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found + + + + Expect a number of calls from method, and mock throwing an exception + + + + + + Method Name + Mocked Exception + Number of times to expect the call + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found + + + + Expect unlimited calls from method + + Method Name + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found + + + + Expect unlimited calls from method, and always returns mock value + + + This is overridden with the limited call methods. ie. + when is used together with then the first value + returned will be the values then the value + + + Method Name + Mocked return value + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found or doesn't return the return value type + + + + Expect unlimited calls from method, and always throws exception + + + This is overridden with the limited call methods. ie. + when is used together with then the first value + returned will be the values then the method will throw the value + + Method Name + Mocked exception + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found + + + + Expect 1 set of a Property + + + + + Property Name + Can Check Property value, see + If property is not found + + + + Expect a number of sets of a Property + + + + + Property Name + Number of times to expect the set + Can Check Property value, see + If property is not found + + + + Expect unlimited set of a Property + + Property Name + Can Check Property value, see + If property is not found + + + + Expect 1 set of a Property and mock throwing an exception + + + + + Property Name + Mocked Exception + Can Check Property value, see + If property is not found + + + + Expect a number of sets of a Property and mock throwing an exception + + + + + Property Name + Mocked Exception + Number of times to expect the call + Can Check Property value, see + If property is not found + + + + Expect unlimited set of a Property and always mock throwing an exception + + Property Name + Mocked Exception + Can Check Property value, see + If property is not found + + + + Verify 1 set of a Property , continue with set method as normal + + + + + Property Name + Can Check Parameters, see + If method not found or is not void + + + + Verify a number of sets of a Property , continue with set method as normal + + + + + Property Name + Number of times to expect + Can Check Parameters, see + If method not found or is not void + + + + Expect 1 get of a Property and mock the Property's value + + + Property Name + Mocked value + If property is not found or is not the correct type + + + + Expect a number of gets of a Property and mock the Property's value + + + Property Name + Mocked value + Number of times to expect the gets + If property is not found or is not the correct type + + + + Expect unlimited get of a Property and always mock the Property's value + + + Property Name + Mocked value + If property is not found or is not correct value type + + + + Expect 1 get of a Property and mock throwing an exception + + Property Name + Mocked Exception + If property is not found + + + + Expect a number of gets of a Property and mock throwing an exception + + Property Name + Mocked Exception + Number of calls to expect + If property is not found + + + + Expect unlimited get of a Property and always mock throwing an exception + + Property Name + Mocked Exception + If property is not found + + + + Verify 1 get of a Property , continue with get method as normal + + + + + Property Name + Can Check Parameters, see + If method not found or is not void + + + + Verify a number of gets of a Property , continue with get method as normal + + + + + Property Name + Number of times to expect + Can Check Parameters, see + If method not found or is not void + + + + Expect 1 set of an Index + + + + + Can Check Property value, see + If index is not found + + + + Expect a number of sets of an Index + + + + + Number of sets to expect + Can Check Property value, see + If index is not found + + + + Expect unlimited set of an Index + + Can Check Property value, see + If index is not found + + + + Expect 1 set of an Index and mock throwing an exception + + + + + Mocked Exception + Can Check Property value, see + If index is not found + + + + Expect a number of sets of an Index and mock throwing an exception + + + + + Mocked Exception + Number of sets to expect + Can Check Property value, see + If index is not found + + + + Expect unlimited set of an Index and mock throwing an exception + + Mocked Exception + Can Check Property value, see + If index is not found + + + + Expect 1 get of an Index and mock the index value + + + + + + Mocked Index Value + Can Check Property value, see + If index is not found + + + + Expect a number of get of an Index and mock the index value + + + + + + Mocked Index Value + Number of sets to expect + Can Check Property value, see + If index is not found + + + + Expect unlimited set of an Index and mock throwing an exception + + Mocked Index Value + Can Check Property value, see + If index is not found + + + + Expect 1 get of an Index and mock throwing an exception + + + + + Mocked Exception + Can Check Property value, see + If index is not found + + + + Expect a number of gets of an Index and mock throwing an exception + + + + + Mocked Exception + Number of expected calls + Can Check Property value, see + If index is not found + + + + Expect unlimited set of an Index and mock throwing an exception + + Mocked Exception + Can Check Property value, see + If index is not found + + + + Expect 1 event listener to be added (event += new EventHandler()) + + Name of Event + A MockedEvent that can be used to the Event + + + + Expect a number of event listeners to be added (event += new EventHandler()) + + Name of Event + Number of times to expect + A MockedEvent that can be used to the Event + + + + Expect unlimited number of event listeners to be added (event += new EventHandler()) + + + When more than one instance of the event published is mocked, use the MockedEvent.[index] property + The first instance to register to the event will be in index 0, the next instance in 1 and so on. + + [Test] + public void SimulateFiringClickOnManyButtons() + { + // Mock all Click Events of the all Buttons + Mock buttonMock = MockManager.MockAll(typeof(Button)); + MockedEvent handle = buttonMock.ExpectAddEventAlways("Click"); + + // create 2 buttons and register to the Click Event + Button button1 = new Button(); + Button button2 = new Button(); + button1.Click += new EventHandler(button_Click); + button2.Click += new EventHandler(button_Click); + + // Simulate firing Click of button1 + handle.Instance[0].Fire(this, EventArgs.Empty); + // Simulate firing Click of button2 + handle.Instance[1].Fire(this, EventArgs.Empty); + // Check that system works... + + MockManager.Verify() + } + + + <Test()> _ + Public Sub SimulateFiringClickOnManyButtons() + 'Mock all Click Events of the all Buttons + Dim buttonMock As Mock = MockManager.MockAll(GetType(Button)) + Dim handle As MockedEvent = buttonMock.ExpectAddEventAlways("Click") + + ' create 2 buttons and register to the Click Event + Dim button1 As Button = New Button + Dim button2 As Button = New Button + + AddHandler button1.Click, AddressOf button_Click + AddHandler button2.Click, AddressOf button_Click + + ' Simulate firing Click of button1 + handle.Instance(0).Fire(Me, EventArgs.Empty) + ' Simulate firing Click of button2 + handle.Instance(1).Fire(Me, EventArgs.Empty) + ' Check that system works... + + MockManager.Verify() + End Sub + + Since Version 3.7 + + Name of Event + A MockedEvent that can be used to the Event + + + + Expect 1 event listener to be removed (event -= new EventHandler()) + + Name of Event + A MockedEvent that can be used to the Event + + + + Expect a number of event listeners to be removed (event -= new EventHandler()) + + Name of Event + Number of times to expect + A MockedEvent that can be used to the Event + + + + Use to mock all anonymous methods that are called from within a method + + Method from which the anonymous method is called + Anonymous Method Mock Name + + Assuming that we have this code + + public void DoSomething() + { + button1.Click += delegate + { + MessageBox.Show("Click!"); + }; + } + public void FireClick() + { + button1.PerformClick(); + } + + We can Mock the button1.Click Anonymous Method as follows: + + [Test] + public void AnonymousTest() + { + // Mock TestedClass + Mock mock = MockManager.Mock(typeof(TestedClass)); + // set up our expectations for anonymous method called in DoSomething + // check that the delegate will be called without displaying the message box + mock.ExpectCall(mock.AnonymousMethod("DoSomething")); + + // create the instances + TestedClass tested = new TestedClass(); + // Test the code + tested.DoSomething(); + tested.FireClick(); + // Verify that all calls were made (This can be done in the [Teardown]) + MockManager.Verify(); + } + + + + + + Clear expectation of a method + + + There are times when you want to clear all the expectations of the mock. + For example, if you setup expectations in the [SetUp] method, but want to clear a mocked + type in a specific test. + + You do not need to call this when using + + Name of method to remove expectations + + + + Clear all expectations + + + There are times when you want to clear all the expectations of the mock. + For example, if you setup expectations in the [SetUp] method, but want to clear a mocked + type in a specific test. + + You do not need to call this when using + + + + Create a Mock object and assign it to a given field. + The name of the field to be mocked + A mock object that is assigned to the field. + Show how to mock a call on a public field. + this works on private members as well + + [Test] + [VerifyMocks] + public void MockInstanceField() + { + // mock next instance creation of ClassWithField + Mock mock = MockManager.Mock(typeof(ClassWithField)); + // mock the "field" field and set the expectation on it + Mock mockedField = mock.MockField("field"); + mockedField.ExpectAndReturn("ReturnFive", 6); + + ClassWithField target = new ClassWithField(); + int actual = target.field.ReturnFive(); + // ReturnFive call is mocked and should return 6 + Assert.AreEqual(6, actual); + } + + + <Test(), VerifyMocks() > _ + Public Sub MockInstanceField() + ' mock next instance creation of ClassWithField + Dim mock As Mock = MockManager.Mock(GetType(ClassWithField)) + ' mock the "field" field and set the expectaion on it + Dim MockedField As Mock = mock.MockField("field") + MockedField.ExpectAndReturn("ReturnFive", 6) + + Dim target As New ClassWithField + Dim actual As Integer = target.field.ReturnFive + ' ReturnFive call is mocked and should return 6 + Assert.AreEqual(6, actual) + End Sub + + + AssignField + If constructor is not mocked, field is not + found or field can't be mocked + + + + Assign a new value to the given field. + + The name of the field to be assigned + The value to assign. + If field is not found or is static + + + Show how to assign values to private fields. + this can also be done to private static fields using the + AssignStaticField API. + + [Test] + [VerifyMocks] + public void AssignField() + { + // create the new value we will assign to the field + FieldClass replacement = new FieldClass(); + // create the mock object + Mock mock = MockManager.Mock<ClassWithField>(); + // if the field wont be assigned accessing it will yield a null reference exception + mock.AssignField("privateField", replacement); + + // verify that the replacement was assigned to the newly crated instance + ClassWithField target = new ClassWithField(); + int actual = target.GetPrivate().GetHashCode(); + Assert.AreEqual(replacement.GetHashCode(), actual); + } + + + //VB + <Test(), VerifyMocks() > _ + Public Sub AssignField() + ' create the new value we will assign to the field + Dim Replacement As New FieldClass + 'create the mock object + Dim mock As Mock = MockManager.Mock(GetType(ClassWithField)) + ' if the field wont be assigned accessing it will yield a null reference exception + mock.AssignField("privateField", Replacement) + + ' verify that the replacement was assigned to the newly crated instance + Dim field As New ClassWithField + Dim hashCode As Integer = field.GetPrivate().GetHashCode() + Assert.AreEqual(Replacement.GetHashCode, hashCode) + End Sub + + + + + + Allow mocking a method in a base class that is hidden by the mocked class + + + In most cases there is no need to use this method as Typemock Isolator will mock all methods in the hierarcy + of the mocked type. CallBase should be used when a method of a base class is overriden in the mocked type, + and there is a need to mock the base method only. + + + public class BaseClass + { + public virtual int SomeMethod() + { + return 1; + } + } + + public class DerivedClass() : BaseClass + { + public override int SomeMethod() + { + return base.SomeMethod() + 1; + } + } + + [Test] + public void Test() + { + Mock mock = MockManager.Mock(typeof(DerivedClass)) + // mock only BaseClass.SomeMethod when called from a DerivedClass Type. + mock.CallBase.ExpectAndReturn("SomeMethod", 100); + DerivedClass d = new DerivedClass(); + Assert.AreEqual(101, d.SomeMethod()); + } + + + Public Class BaseClass + Public Overridable Function SomeMethod() As Integer + Return 1 + End Function + End Class + + Public Class DerivedClass + Inherits BaseClass + Public Overrides Function SomeMethod() As Integer + Return 1 + End Function + End Class + + <Test()> _ + Public Sub Test() + Dim mock As Mock = MockManager.Mock(GetType(DerivedClass)) + ' mock only BaseClass.SomeMethod when called from a DerivedClass Type. + mock.CallBase.ExpectAndReturn("SomeMethod", 100) + Dim d As DerivedClass = New DerivedClass + Assert.AreEqual(101, d.SomeMethod()) + End Sub + + + + If a static method is mocked + + + + Obsolete. Argument validation is done both on calling the method and during Verify. + Postpone throwing validation errors till is called + + + Using ValidateArgsOnVerify, validation errors are thrown after Verify is called. + This is useful if the validation is done in another thread and you want the thread to continue. + When Verify is called all argument validations are shown too. + + + + + + Event that is set when all expectations have been made, used for verify with timeout + + + + used to store mocked fields objects which will be assigned upon object creation + + + Used to store fields which will be assigned to the field of the next object + + + Marks the mock as one sitting on a field (needed for license verification) + + + + Constructer, keep internal + + Link to mock for static methods + Type to be mocked + flag to mock constructors + + + + This mock is filled when a recorder is recording on this instance + but it has to register on the recorder mock future instance + + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler. Properties and + indexes can be tweaked using , + , + and + + + + + + Name of method + Interface to change method Behavior + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler + + Name of Property + + Interface to change method Behavior + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler + + Name of Property + + Interface to change method Behavior + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler + + + Interface to change method Behavior + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + Currently you can set Strictness and CallEventHandler + + + Interface to change method Behavior + + + + Check if method is in the expectation table + + + + + + + + + + Used by StaticMock to count references of Mocks so that the last + verify will verify the static too. + + + + + Mock Constructor + + + Using MockConstructor will enable verifying arguments passed + to the constructor + + Can Check Parameters, see + + + + Mock Constructor + + + Using ExpectConstructor will verify that a constructor has been called and can be used to validate the arguments passed + to the constructor + + Can Check Parameters, see + + + + Mock Constructor + + + Using ExpectConstructor will verify that a constructor has been called and can be used to validate the arguments passed + to the constructor + + Number of times to expect + Can Check Parameters, see + + + + Mock unlimited calls from Constructor + + Can Check Parameters, see + + + + Mock Constructor and throw exception when constructor is called + + + Using ExpectConstructorAndThrow will throw an exception when the constructor + is called + + Mocked Exception + Can Check Parameters, see + + + + Don't Mock Constructor but verify arguments + + + Using MockConstructor will enable verifying arguments passed + to the constructor + + Can Check Parameters, see + + + + Don't Mock Constructor but verify arguments + + + Using MockConstructor will enable verifying arguments passed + to the constructor + + Number of times to expect + Can Check Parameters, see + + + + Verify 1 call from method , continue with method as normal + + + + + Method Name + Can Check Parameters, see + If method not found or is not void + + + + Verify 1 call from method , continue with method as normal + + + + + Method Name + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method not found or is not void + + + + Verify a number of calls from method , continue with method as normal + + + + + Method Name + Number of times to expect + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method not found or is not void + + + + Expect 1 call from method + + + + + Method Name + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method not found or is not void + + + + Expect a number of calls from method + + + + + Method Name + Number of times to expect the call + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method not found or is not void + + + + Expect 1 call from method, and mock return value + + Method Name + Mocked return value + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found or doesn't return the return value type + + + + + + + + Expect a number of calls from method, and mock return value + + Method Name + Mocked return value + Number of times to expect the call + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found or doesn't return the return value type + + + + + + + + Expect 1 call from method, and mock throwing an exception + + + + + + Method Name + Mocked Exception + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found + + + + Expect a number of calls from method, and mock throwing an exception + + + + + + Method Name + Mocked Exception + Number of times to expect the call + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found + + + + Expect unlimited calls from method + + Method Name + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found + + + + Expect unlimited calls from method, and always returns mock value + + + This is overridden with the limited call methods. ie. + when is used together with then the first value + returned will be the values then the value + + + Method Name + Mocked return value + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found or doesn't return the return value type + + + + Expect unlimited calls from method, and always throws exception + + + This is overridden with the limited call methods. ie. + when is used together with then the first value + returned will be the values then the method will throw the value + + Method Name + Mocked exception + List of generic types, to mock bounded generic methods + Can Check Parameters, see + If method is not found + + + + Expect 1 set of a Property + + + + + Property Name + Can Check Property value, see + If property is not found + + + + Expect a number of sets of a Property + + + + + Property Name + Number of times to expect the set + Can Check Property value, see + If property is not found + + + + Expect unlimited set of a Property + + Property Name + Can Check Property value, see + If property is not found + + + + Expect 1 set of a Property and mock throwing an exception + + + + + Property Name + Mocked Exception + Can Check Property value, see + If property is not found + + + + Expect a number of sets of a Property and mock throwing an exception + + + + + Property Name + Mocked Exception + Number of times to expect the call + Can Check Property value, see + If property is not found + + + + Expect unlimited set of a Property and always mock throwing an exception + + Property Name + Mocked Exception + Can Check Property value, see + If property is not found + + + + Verify 1 set of a Property , continue with set method as normal + + + + + Property Name + Can Check Parameters, see + If method not found or is not void + + + + Verify a number of sets of a Property , continue with set method as normal + + + + + Property Name + Number of times to expect + Can Check Parameters, see + If method not found or is not void + + + + Expect 1 get of a Property and mock the Property's value + + + Property Name + Mocked value + If property is not found or is not the correct type + + + + Expect a number of gets of a Property and mock the Property's value + + + Property Name + Mocked value + Number of times to expect the gets + If property is not found or is not the correct type + + + + Expect unlimited get of a Property and always mock the Property's value + + + Property Name + Mocked value + If property is not found or is not correct value type + + + + Expect 1 get of a Property and mock throwing an exception + + Property Name + Mocked Exception + If property is not found + + + + Expect a number of gets of a Property and mock throwing an exception + + Property Name + Mocked Exception + Number of calls to expect + If property is not found + + + + Expect unlimited get of a Property and always mock throwing an exception + + Property Name + Mocked Exception + If property is not found + + + + Verify 1 get of a Property , continue with get method as normal + + + + + Property Name + Can Check Parameters, see + If method not found or is not void + + + + Verify a number of gets of a Property , continue with get method as normal + + + + + Property Name + Number of times to expect + Can Check Parameters, see + If method not found or is not void + + + + Expect 1 set of an Index + + + + + Can Check Property value, see + If index is not found + + + + Expect a number of sets of an Index + + + + + Number of sets to expect + Can Check Property value, see + If index is not found + + + + Expect unlimited set of an Index + + Can Check Property value, see + If index is not found + + + + Expect 1 set of an Index and mock throwing an exception + + + + + Mocked Exception + Can Check Property value, see + If index is not found + + + + Expect a number of sets of an Index and mock throwing an exception + + + + + Mocked Exception + Number of sets to expect + Can Check Property value, see + If index is not found + + + + Expect unlimited set of an Index and mock throwing an exception + + Mocked Exception + Can Check Property value, see + If index is not found + + + + Expect 1 get of an Index and mock the index value + + + + + + Mocked Index Value + Can Check Property value, see + If index is not found + + + + Expect a number of get of an Index and mock the index value + + + + + + Mocked Index Value + Number of sets to expect + Can Check Property value, see + If index is not found + + + + Expect unlimited set of an Index and mock throwing an exception + + Mocked Index Value + Can Check Property value, see + If index is not found + + + + Expect 1 get of an Index and mock throwing an exception + + + + + Mocked Exception + Can Check Property value, see + If index is not found + + + + Expect a number of gets of an Index and mock throwing an exception + + + + + Mocked Exception + Number of expected calls + Can Check Property value, see + If index is not found + + + + Expect unlimited set of an Index and mock throwing an exception + + Mocked Exception + Can Check Property value, see + If index is not found + + + Create a Mock object and assign it to a given field. + The name of the field to be mocked + A mock object that is assigned to the field. + Show how to mock a call on a public field. + this works on private members as well + + [Test] + [VerifyMocks] + public void MockInstanceField() + { + // mock next instance creation of ClassWithField + Mock mock = MockManager.Mock(typeof(ClassWithField)); + // mock the "member" field and set the expectation on it + Mock mockedField = mock.MockField("member"); + mockedField.ExpectAndReturn("ReturnFive", 6); + + ClassWithField target = new ClassWithField(); + int actual = target.member.ReturnFive(); + // ReturnFive call is mocked and should return 6 + Assert.AreEqual(6, actual); + } + + + //VB + <Test(), VerifyMocks() > _ + Public Sub MockInstanceField() + ' mock next instance creation of ClassWithField + Dim mock As Mock = MockManager.Mock(GetType(ClassWithField)) + ' mock the "member" field and set the expectaion on it + Dim MockedField As Mock = mock.MockField("member") + MockedField.ExpectAndReturn("ReturnFive", 6) + + Dim target As New ClassWithField + Dim actual As Integer = target.member.ReturnFive + ' ReturnFive call is mocked and should return 6 + Assert.AreEqual(6, actual) + End Sub + + + AssignField + If constructor is not mocked, field is not + found or field can't be mocked + + + + Assign a new value to the given field. + + The name of the field to be assigned + The value to assign. + If field is not found or is static, or if the class's constructor is not mocked + + + Show how to assign values to private fields. + this can also be done to private static fields using the + AssignStaticField API. + + [Test] + [VerifyMocks] + public void AssignField() + { + // create the new value we will assign to the field + FieldClass replacement = new FieldClass(); + // create the mock object + Mock mock = MockManager.Mock<ClassWithField>(); + // if the field wont be assigned accessing it will yield a null reference exception + mock.AssignField("privateMember", replacement); + + // verify that the replacement was assigned to the newly crated instance + ClassWithField target = new ClassWithField(); + int actual = target.GetPrivate().GetHashCode(); + Assert.AreEqual(replacement.GetHashCode(), actual); + } + + + //VB + <Test(), VerifyMocks() > _ + Public Sub AssignField() + ' create the new value we will assign to the field + Dim Replacement As New FieldClass + 'create the mock object + Dim mock As Mock = MockManager.Mock(GetType(ClassWithField)) + ' if the field wont be assigned accessing it will yield a null reference exception + mock.AssignField("privateMember", Replacement) + + ' verify that the replacement was assigned to the newly crated instance + Dim field As New ClassWithField + Dim hashCode As Integer = field.GetPrivate().GetHashCode() + Assert.AreEqual(Replacement.GetHashCode, hashCode) + End Sub + + + + + + Create a mock object on all the fields (which are classes) + done by default in natural mocks, when encountering a ctor recording + + + + + Create a mock object on all static fields of the class + done by default in natural mocks when encountering a cctor recording + + + + + gop over mocked field list and atatch the mocks to the created object + and then go over user assigned values and assign them to the fields + this is called when creating the real object + + the real object being created + + + + Expect unlimited number of event listeners to be added (event += new EventHandler()) + + + When more than one instance of the event published is mocked, use the MockedEvent.[index] property + The first instance to register to the event will be in index 0, the next instance in 1 and so on. + + [Test] + public void SimulateFiringClickOnManyButtons() + { + // Mock all Click Events of the all Buttons + Mock buttonMock = MockManager.MockAll(typeof(Button)); + MockedEvent handle = buttonMock.ExpectAddEventAlways("Click"); + + // create 2 buttons and register to the Click Event + Button button1 = new Button(); + Button button2 = new Button(); + button1.Click += new EventHandler(button_Click); + button2.Click += new EventHandler(button_Click); + + // Simulate firing Click of button1 + handle.Instance[0].Fire(this, EventArgs.Empty); + // Simulate firing Click of button2 + handle.Instance[1].Fire(this, EventArgs.Empty); + // Check that system works... + + MockManager.Verify() + } + + + <Test()> _ + Public Sub SimulateFiringClickOnManyButtons() + 'Mock all Click Events of the all Buttons + Dim buttonMock As Mock = MockManager.MockAll(GetType(Button)) + Dim handle As MockedEvent = buttonMock.ExpectAddEventAlways("Click") + + ' create 2 buttons and register to the Click Event + Dim button1 As Button = New Button + Dim button2 As Button = New Button + + AddHandler button1.Click, AddressOf button_Click + AddHandler button2.Click, AddressOf button_Click + + ' Simulate firing Click of button1 + handle.Instance(0).Fire(Me, EventArgs.Empty) + ' Simulate firing Click of button2 + handle.Instance(1).Fire(Me, EventArgs.Empty) + ' Check that system works... + + MockManager.Verify() + End Sub + + Since Version 3.7 + + Name of Event + A MockedEvent that can be used to the Event + + + + Expect 1 event listener to be added (event += new EventHandler()) + + Name of Event + A MockedEvent that can be used to the Event + + + + Expect a number of event listeners to be added (event += new EventHandler()) + + Name of Event + Number of times to expect + A MockedEvent that can be used to the Event + + + + Expect 1 event listener to be removed (event -= new EventHandler()) + + Name of Event + A MockedEvent that can be used to the Event + + + + Expect a number of event listeners to be removed (event -= new EventHandler()) + + Name of Event + Number of times to expect + A MockedEvent that can be used to the Event + + + + Use to mock all anonymous methods that are called from within a method + + Method from which the anonymous method is called + Anonymous Method Mock Name + + Assuming that we have this code + + public void DoSomething() + { + button1.Click += delegate + { + MessageBox.Show("Click!"); + }; + } + public void FireClick() + { + button1.PerformClick(); + } + + We can Mock the button1.Click Anonymous Method as follows: + + [Test] + public void AnonymousTest() + { + // Mock TestedClass + Mock mock = MockManager.Mock(typeof(TestedClass)); + // set up our expectations for anonymous method called in DoSomething + // check that the delegate will be called without displaying the message box + mock.ExpectCall(mock.AnonymousMethod("DoSomething")); + + // create the instances + TestedClass tested = new TestedClass(); + // Test the code + tested.DoSomething(); + tested.FireClick(); + // Verify that all calls were made (This can be done in the [Teardown]) + MockManager.Verify(); + } + + + + + + Verify mocked type + + + Part of Test Driven Development and Mock Methodology is being sure that ALL our + expected calls where actually called. This should always be the final part of the test + If some methods that we expected to be called where not called this will fail the test. + + This is automatically called when using MockManager.Verify() see + + For an example see + + + Using we can also define, that calls to methods that where + not expected, will fail the test too. + + + + + + Wait with timeout (5 seconds) for all expected methods to be called + + + VerifyWithTimeout will wait for all expectations to be called. If the Timeout is triggered + the test will fail. + Part of Test Driver Development and Mock Methodology is being sure that ALL our + expected calls where actually called. There are cases when mocks are called in a-synchronic + code or are encapsulated in a try catch block and errors are not thrown to testing method. + In these cases using VerifyWithTimeout will enable us to validate our code and return as soon as + the expected methods are called without needing to add Pause statements + + This is automatically called when using MockManager.VerifyWithTimeout() see + + + [Test] + public void TestCallsInOtherThread () + { + // Let mock the product - it will not mock constructors; + Mock productMock = MockManager.Mock(typeof(Product),Constructor.NotMocked); + // CalculatePrice will return 10 - expect 10 as argument + productMock.ExpectAndReturn("CalculatePrice",10F).Args(10); + // our method will be called in a new thread + Thread theThread = new Thread(new ThreadStart(RunWithWait)); + theThread.Start(); + // If we use Verify we dont know when the thread will actually be called + // Here we WAIT for the mocked methods to be called, or the timeout. + // Default timeout is 5000 milliseconds + productMock.VerifyWithTimeout(); + } + + + <Test()> _ + Public Sub TestCallsInOtherThread() + ' Let mock the product - this will mock the next invocation of Product, + ' it will mock constructors too so our price will be 0 + Dim productMock As Mock = MockManager.Mock(GetType(Product), Constructor.NotMocked) + ' CalculatePrice will return 10 - expect 10 as argument + productMock.ExpectAndReturn("CalculatePrice", 10.0F).Args(10) + ' our method will be called in a new thread + Dim theThread As Thread = New Thread(AddressOf RunWithWait) + theThread.Start() + ' If we use Verify we dont know when the thread will actually be called + ' Here we WAIT for the mocked methods to be called, or the timeout. + ' Default timeout is 5000 milliseconds + productMock.VerifyWithTimeout() + End Sub + + + + + + + Wait with timeout (im milliseconds) for all expected methods to be called + + + VerifyWithTimeout will wait for all expectations to be called. If the Timeout is triggered + the test will fail. + Part of Test Driver Development and Mock Methodology is being sure that ALL our + expected calls where actually called. There are cases when mocks are called in a-synchronic + code or are encapsulated in a try catch block and errors are not thrown to testing method. + In these cases using VerifyWithTimeout will enable us to validate our code and return as soon as + the expected methods are called without needing to add Pause statements + + This is automatically called when using MockManager.VerifyWithTimeout() see + + + [Test] + public void TestCallsInOtherThread () + { + // Let mock the product - it will not mock constructors; + Mock productMock = MockManager.Mock(typeof(Product),Constructor.NotMocked); + // CalculatePrice will return 10 - expect 10 as argument + productMock.ExpectAndReturn("CalculatePrice",10F).Args(10); + // our method will be called in a new thread + Thread theThread = new Thread(new ThreadStart(RunWithWait)); + theThread.Start(); + // If we use Verify we dont know when the thread will actually be called + // Here we WAIT 1000 milliseconds for the mocked methods to be called, or the timeout. + productMock.VerifyWithTimeout(1000); + } + + <Test()> _ + Public Sub TestCallsInOtherThread() + ' Let mock the product - this will mock the next invocation of Product, + ' it will mock constructors too so our price will be 0 + Dim productMock As Mock = MockManager.Mock(GetType(Product), Constructor.NotMocked) + ' CalculatePrice will return 10 - expect 10 as argument + productMock.ExpectAndReturn("CalculatePrice", 10.0F).Args(10) + ' our method will be called in a new thread + Dim theThread As Thread = New Thread(AddressOf RunWithWait) + theThread.Start() + ' If we use Verify we dont know when the thread will actually be called + ' Here we WAIT 1000 milliseconds for the mocked methods to be called, or the timeout. + productMock.VerifyWithTimeout(1000) + End Sub + + + + Time to wait for all expected methods to be called + + + + Clear expectation of a method + + + There are times when you want to clear all the expectations of the mock. + For example, if you setup expectations in the [SetUp] method, but want to clear a mocked + type in a specific test. + + You do not need to call this when using + + Name of method to remove expectations + + + + Clear all expectations + + + There are times when you want to clear all the expectations of the mock. + For example, if you setup expectations in the [SetUp] method, but want to clear a mocked + type in a specific test. + + You do not need to call this when using + + + + + Clear expectation of an expectation block + + + There are times when you want to clear expectations of the mock. + For example, if you use a utility class that contains an expectation block that + is not needed in a specific test. + + You do not need to call this when using + + + The Block to Clear + + + + Return the amount of times a method has been called + + + Can be used as part of a validation. + + In the following example we validate that the doSomething() Method has been called 3 times, + while keeping the original functionality (not mocked) + + + [Test] + public void Test() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + t.doSomething(); + t.doSomething(); + t.doSomething(); + Assert.AreEqual(3,mock.GetCallCount("doSomething")); + } + + + <Test()> _ + Public Sub Test() + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass() + t.doSomething() + t.doSomething() + t.doSomething() + Assert.AreEqual(3,mock.GetCallCount("doSomething")) + End Sub + + For Properties and Indexers see , + and + + mock.GetCallCount("doSomething") is equivalent to + MockManager.CalledCounter("TestClassLibrary.TestedClass","doSomething") + See + + + String representation of Method + Number of times the method has been called + + + + Return the amount of times a method has been called + + String representation of Method + Generic parameters list of the method + Number of times the method has been called + + + + Return the amount of times a property has been called + + + See + + String representation of the Property + Number of times the property has been called + + + + Return the amount of times a property has been set + + + See + + String representation of the Property + Number of times the property has been set + + + + Return the amount of times an indexer has been called + + + See + + Number of times the indexer has been called + + + + Start an expectation block + + + + Group a number of expectation. When grouping expectations in a block you can control + The expectation dynamically. This is very useful when setting up a mock infrastructure. + After defining a block it is possible to: + + Remove the block using . + + + Add expectations before the block using . + + + Blocks can be labeled and can be later on referred to by . + + Blocks can have different s. + + The following example shows a utility method that sets up expectations + for an AccessController + + private Mock SetupExpectations() + { + //Mock all invocation of AccessController, + Mock mock = MockManager.MockAll(typeof(AccessController)); + + // start a block called loginLabel, this will be verified normally + mock.StartBlock("loginLabel",VerifyMode.Normal); + // We expect that the login method will be called and we will return + // AccessStatus.INVALID_USER the first time and AccessStatus.VALIDATED the + // second time + mock.ExpectAndReturn("Login", AccessStatus.INVALID_USER); + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + mock.EndBlock(); + + // expect another call and return validated. + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + return mock; + } + [Test] + public void TestSomething() + { + Mock mock = SetupExpectations(); + + // In this test we need to add an expectation before our block + mock.StartBlockBefore(mock.GetBlock("loginLabel")); + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + mock.EndBlock(); + + // continue with test + } + [Test] + public void TestSomething2() + { + Mock mock = SetupExpectations(); + + // In this test we need to remove the expectation our block + mock.Clear(mock.GetBlock("loginLabel")); + + // continue with test + } + + + Private Function SetupExpectations() As Mock + 'Mock all invocation of AccessController, + Dim mock As Mock = MockManager.Mock(GetType(AccessController)) + + ' start a block called loginLabel, this will be verified normally + mock.StartBlock("loginLabel",VerifyMode.Normal) + ' We expect that the login method will be called and we will return + ' AccessStatus.INVALID_USER the first time and AccessStatus.VALIDATED the + ' second time + mock.ExpectAndReturn("Login", AccessStatus.INVALID_USER) + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + mock.EndBlock() + + ' expect another call and return validated. + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + SetupExpectations = mock + End Function + <Test()> _ + Public Sub TestSomething() + Dim mock As Mock = SetupExpectations() + + ' In this test we need to add an expectation before our block + mock.StartBlockBefore(mock.GetBlock("loginLabel")) + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + mock.EndBlock() + + ' continue with test + End Sub + <Test()> _ + Public Sub TestSomething2() + Dim mock As Mock = SetupExpectations() + + ' In this test we need to remove the expectation our block + mock.Clear(mock.GetBlock("loginLabel")) + + ' continue with test + End Sub + + + + + + + + The Expectation Block + + + + Start an expectation block with a label name + + + + + + + + The label given to the block, can then be retrieved using + The Expectation Block + Will be throw if a block with the same label name exists already + + + + + Start an expectation block with a verify mode + + + + + + + + The verify mode of the block + The Expectation Block + + + + Start an expectation block with a label and a verify mode + + + + + + + + The label given to the block, can then be retrieved using + The verify mode of the block + The Expectation Block + Will be throw if a block with the same label name exists already + + + + + Retrieve Expectation Block, by its label name + + The Expectation blocks label + The Expectation block + Will be throw if a block doesn't exist + + + + + + Start an expectation block and adds the expectations before another expectation + block + + + Add expectations before another expectation block. This is very useful when setting up a mock infrastructure. + + Blocks can be labeled and can be later on referred to by . + + Blocks can have different s. + + The following example shows a utility method that sets up expectations + for an AccessController + + private Mock SetupExpectations() + { + //Mock all invocation of AccessController, + Mock mock = MockManager.MockAll(typeof(AccessController)); + + // start a block called loginLabel, this will be verified normally + mock.StartBlock("loginLabel",VerifyMode.Normal); + // We expect that the login method will be called and we will return + // AccessStatus.INVALID_USER the first time and AccessStatus.VALIDATED the + // second time + mock.ExpectAndReturn("Login", AccessStatus.INVALID_USER); + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + mock.EndBlock(); + + // expect another call and return validated. + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + return mock; + } + [Test] + public void TestSomething() + { + Mock mock = SetupExpectations(); + + // In this test we need to add an expectation before our block + mock.StartBlockBefore(mock.GetBlock("loginLabel")); + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + mock.EndBlock(); + + // continue with test + } + [Test] + public void TestSomething2() + { + Mock mock = SetupExpectations(); + + // In this test we need to remove the expectation our block + mock.Clear(mock.GetBlock("loginLabel")); + + // continue with test + } + + + Private Function SetupExpectations() As Mock + 'Mock all invocation of AccessController, + Dim mock As Mock = MockManager.Mock(GetType(AccessController)) + + ' start a block called loginLabel, this will be verified normally + mock.StartBlock("loginLabel",VerifyMode.Normal) + ' We expect that the login method will be called and we will return + ' AccessStatus.INVALID_USER the first time and AccessStatus.VALIDATED the + ' second time + mock.ExpectAndReturn("Login", AccessStatus.INVALID_USER) + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + mock.EndBlock() + + ' expect another call and return validated. + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + SetupExpectations = mock + End Function + <Test()> _ + Public Sub TestSomething() + Dim mock As Mock = SetupExpectations() + + ' In this test we need to add an expectation before our block + mock.StartBlockBefore(mock.GetBlock("loginLabel")) + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + mock.EndBlock() + + ' continue with test + End Sub + <Test()> _ + Public Sub TestSomething2() + Dim mock As Mock = SetupExpectations() + + ' In this test we need to remove the expectation our block + mock.Clear(mock.GetBlock("loginLabel")) + + ' continue with test + End Sub + + + + + + + The Expectations block to add expectations before + The Expectation Block + + + + Start an expectation block with a label and adds the expectations before another expectation + block + + + + + + + The Expectation block to add expectations before + The label given to the block, can then be retrieved using + The Expectation Block + Will be throw if a block with the same label name exists already + + + + + Start an expectation block with a verify mode and adds the expectations before another expectation + block + + + + + + + The Expectation block to add expectations before + The verify mode of the block + The Expectation Block + + + + Start an expectation block with a label and a verify mode, and adds the expectations before another expectation + block + + + + + + + The Expectation block to add expectations before + The label given to the block, can then be retrieved using + The verify mode of the block + The Expectation Block + Will be throw if a block with the same label name exists already + + + + + End an expectation block + + + + + + + + + + Can set the mock to be Strict + The default is the Methods of Abstract and Interfaces are Strict and Arbitrary calls fail + while Arbitrary Methods of concrete classes are allowed. + + + By default Mocked Concrete Types are NOT strict this mean that if a call to a mocked + method was not expected the normal code is executed. + Mocked Types can be made strict and fail if an unexpected call is made + + [Test] + public void Test() + { + // Start mocking TestedClass + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + // No expectations, the following will run normal passInt if Strict=false + // and will fail if Strict=true + t.passInt(10); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub Test() + { + ' Start mocking TestedClass + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + ' No expectations, the following will run normal passInt if Strict=false + ' and will fail if Strict=true + t.passInt(10) + MockManager.Verify() + End Sub + + + To set only one method to strict use: + + + When allowing arbitrary abstract methods (methods created dynamically by Typemock Isolator using or ), + Typemock Isolator create the following default behavior: + 1. All void calls just return + 2. Other Methods will return 0 or null depending on the return type + 3. Properties will behave like normal properties + + + + + + + + Can set the static methods of a mocked type to be Strict + + + By default Mocked Types are NOT strict this mean that if a call to a mocked + method was not expected the normal code is executed. + Mocked Types Static Members can be made strict and fail if an unexpected call is made + To set only one method to strict use: + + + + + + + + Get the actual instance that is being mocked and controlled. This + enables tracking instance mocks to the actual instance + + + When using instance mocks (Mock and MockObject) this property returns the instance mocked + + + MockObject will return the same result although has a different usage + + + MockAll mocks and Mocks that haven't been created yet (new not called) will return null (Nothing in Visual Basic) + + + Being able to reference the mocked instance enables testing fields of future object. + Example of using Typemock Isolator to test a field of a future object + + + public static void CreateAnObject() + { + TestClass theClass = new TestClass(); + theClass.field = 5; + ... + } + [Test] + public void VerifyFutureObject() + { + //Create new Mock for a future Object, no expectations + Mock mock = MockManager.Mock(typeof(TestClass)); + + // Call our code + TheClass.CreateAnObject(); + + // get the mocked object and test the field + TestClass theClass = mock.MockedInstance as TestClass; + Assert.AreEqual(5, theClass.field); + + // Verify that all the expected calls have actually been called. + MockManager.Verify(); + } + + + Public Shared Sub CreateAnObject() + Dim theClass As TestClass = New TestClass() + theClass.field = 5 + ... + End Sub + + <Test()> _ + Public Sub ValidateValidUser() + ' Create new Mock for a future Object, no expectations + Dim mock As Mock = MockManager.Mock(GetType(TestClass)) + + ' call our code + TheClass.CreateAnObject() + ' Get the mocked object and test the field + Dim theClass As TestClass = mock.MockedInstance + Assert.AreEqual(5, theClass.field) + + ' Verify that all the expected calls have actually been called. + MockManager.Verify() + End Sub + + + + Mock Instance + + + + used to specifiy that this is a mock created for a field inside an object + + + + + Allow mocking a method in a base class that is hidden by the mocked class + + + In most cases there is no need to use this method as Typemock Isolator will mock all methods in the hierarcy + of the mocked type. CallBase should be used when a method of a base class is overriden in the mocked type, + and there is a need to mock the base method only. + + + public class BaseClass + { + public virtual int SomeMethod() + { + return 1; + } + } + + public class DerivedClass : BaseClass + { + public override int SomeMethod() + { + return base.SomeMethod() + 1; + } + } + + [Test] + public void Test() + { + Mock mock = MockManager.Mock(typeof(DerivedClass)) + // mock only BaseClass.SomeMethod when called from a DerivedClass Type. + mock.CallBase.ExpectAndReturn("SomeMethod", 100); + DerivedClass d = new DerivedClass(); + Assert.AreEqual(101, d.SomeMethod()); + } + + + Public Class BaseClass + Public Overridable Function SomeMethod() As Integer + Return 1 + End Function + End Class + + Public Class DerivedClass + Inherits BaseClass + Public Overrides Function SomeMethod() As Integer + Return 1 + End Function + End Class + + <Test()> _ + Public Sub Test() + Dim mock As Mock = MockManager.Mock(GetType(DerivedClass)) + ' mock only BaseClass.SomeMethod when called from a DerivedClass Type. + mock.CallBase.ExpectAndReturn("SomeMethod", 100) + Dim d As DerivedClass = New DerivedClass + Assert.AreEqual(101, d.SomeMethod()) + End Sub + + + + If a static method is mocked + + + + Allow mocking a static method when that method is overloaded with an instance method + + In most cases there is no need to use this method as Typemock Isolator will mock all static methods + of the mocked type. CallStatic should be used when an instance method and a static method have the same name + By default the instance methods are returned. + + If instance methods are mocked + + + + + Obslolete. Argument validation is done both on calling the method and during Verify. + + + Using ValidateArgsOnVerify, validation errors are thrown after Verify is called. + This is useful if the validation is done in another thread and you want the thread to continue. + When Verify is called all argument validations are shown too. + + The flag will be deleted in future + + + + Get the type that is mocked and controlled. + + + + + Event that is fired after a mocked method is called and after argument validation is performed + + + + To set an event per method see + When static methods are called events from ALL mocks of that type are triggered. So if a type is mocked for + two instances, and both have AfterMock Events, both will be triggered after a static member of that type is called. This + is because static methods are not associated with an instance. + + + + + + Do not create this type, use MockManager. + + Link to mock for static methods + Type to be mocked + flag to mock constructors + + + + Get the Mocked Object + + + + + Create an instance of TMockedType and Control the behavior of that instance. + + The Type to Mock + + is the Typemock Isolator mock type controller, this class is use for managing the + virtual mocks, using generic code sugar, to ease the mock creation. + + There are 3 types of mocks + + + MockManager. - Will mock the next 'new' instance of the mocked Type (and all static methods) + + + MockManager. - Will mock ALL (future and past) instances of the mocked Type + + + MockManager. - Will create ONE instance of the Type. This instance is mocked + + + + + MockManager. methods are used to create a mocked instance and return a controller to defined expectations + on the mocked instance mock. After creating a mocked object the actual instance is in . + + + RecorderManager. methods are used to create a mocked instance and return the actual instance. + This is useful for Natural Mocks + + + To mock create any object (including Interfaces) Use MockManager."/> + When creating a mock object Typemock Isolator will choose a constructor with the highest visibility and create default values for the + arguments, to send specific arguments use MockManager. + + + After creating a mocked object the actual instance is in . + + + + + + + + + is the Typemock Isolator mock type controller, this class is use for managing the + virtual mocks, using generic code sugar, to ease the mock creation. + + The Type to Mock + + There are 3 types of mocks + + + MockManager. - Will mock the next 'new' instance of the mocked Type (and all static methods) + + + MockManager. - Will mock ALL (future and past) instances of the mocked Type + + + MockManager. - Will create ONE instance of the Type. This instance is mocked + + + + + To mock Interfaces, Use MockManager. + + + + + + + + + Get the mocked instance. + + + + + Summary description for About. + + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + Typemock Natural Mocks can validates parameter values, collections and arrays, + as well as repeat expectation. + + + To change to mock Behavior use IMockBehavior returned from methods + You can validate that parameters passed are as you expected and repeat the expectations. + + This Interface is not to be implemented by client + + + + + + Validate that the arguments passed are as expected + + + + list of expected parameters and/or parameter checkers + Will be throw if more then 30 parameters are used per method + It is possible to check that a mocked method has been called with specific parameter + values. + + + + For example, if we need to check that an int parameter is 10 + we can write the following code + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // Mock new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // First time PassInt to be called. + mockedTestedClass.PassInt(10); + // check that 10 has been passed + recorder.CheckArguments(); + + // Second time PassInt to be called. + mockedTestedClass.PassInt(10); + // check that 1 or 2 is passed + recorder.CheckArguments(Check.IsIn(1,2))); + } + + // run our code + TestedClass t = new TestedClass(); + // This will pass + t.passInt(10); + // This will fail + t.passInt(3); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' Mock new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' First time PassInt to be called. + mockedTestedClass.PassInt(10) + ' check that 10 has been passed + recorder.CheckArguments() + + ' Second time PassInt to be called. + mockedTestedClass.PassInt(10); + ' check that 1 or 2 is passed + recorder.CheckArguments(Check.IsIn(1,2))) + End Using + + ' run our code + Dim t As TestedClass = New TestedClass + ' This will pass + t.passInt(10) + ' This will fail + t.passInt(3) + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + Single Dimension Arrays and Collections are iterated and checked for match of all items + See for built in ParameterCheckers + See for details of user defined checks + + + BEWARE, Typemock Isolator normally checks the type of return value with the existing + method, but it does not check the legitimacy of the returned value in case of + overloaded methods that have different return types, (as Typemock Isolator sees these + as one mocked method) if you return a value with the wrong type a + System.InvalidCastException will be thrown + + + Typemock Isolator supports checking methods with up to 30 parameters + + + + + + + + Mock method only when arguments passed are as expected + + + + list of expected parameters and/or parameter checkers + Will be throw if more then 30 parameters are used per method + It is possible to check that a mocked method has been called with specific parameter + values and to return mocked values when this is true. + *Enterprise Edition Only* + + + + For example, we have a method PassInt, that returns a string, and has an int parameter. + We need to return "one" whenever the argument is 1 + we can write the following code + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // Mock new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // always return "one" when 1 was passed + mockedTestedClass.PassInt(1); + recorder.Return("one").RepeatAlways().WhenArgumentsMatch(); + + // always return "two" when 2 or 3 is passed + mockedTestedClass.PassInt(2); + recorder.Return("two").RepeatAlways().WhenArgumentsMatch(Check.IsIn(1,2)); + } + + // run our code + TestedClass t = new TestedClass(); + // This will pass + Assert.AreEqual("one",t.passInt(1)); + Assert.AreEqual("two",t.passInt(3)); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' Mock new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' always return "one" when 1 was passed + mockedTestedClass.PassInt(1) + recorder.Return("one").RepeatAlways().WhenArgumentsMatch() + + ' always return "two" when 2 or 3 is passed + mockedTestedClass.PassInt(2); + recorder.Return("two").RepeatAlways().WhenArgumentsMatch(Check.IsIn(1,2)) + End Using + + ' run our code + Dim t As TestedClass = New TestedClass + ' This will pass + Assert.AreEqual("one",t.passInt(1)) + Assert.AreEqual("two",t.passInt(3)) + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + Single Dimension Arrays and Collections are iterated and checked for match of all items + See for built in ParameterCheckers + See for details of user defined checks + + + BEWARE, Typemock Isolator normally checks the type of return value with the existing + method, but it does not check the legitimacy of the returned value in case of + overloaded methods that have different return types, (as Typemock Isolator sees these + as one mocked method) if you return a value with the wrong type a + System.InvalidCastException will be thrown + + + Typemock Isolator supports checking methods with up to 30 parameters + + + + + + + + Don't Validate that the arguments passed are as expected. This is the default Behavior + + + + + + For example, if we want to ignore the parameters passed we can write the following code + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // Mock new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // First time PassInt to be called. + mockedTestedClass.PassInt(10); + // don't check that 10 has been passed + recorder.IgnoreArguments(); + + // Second time PassInt to be called. + mockedTestedClass.PassInt(10); + // check that 1 or 2 is passed + recorder.CheckArguments(Check.IsIn(1,2))); + } + + // run our code + TestedClass t = new TestedClass(); + // This will pass (ignored) + t.passInt(1); + // This will fail + t.passInt(3); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations] + ' CAUTION: ALL calls here are mocked!!! + ' Mock new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' First time PassInt to be called. + mockedTestedClass.PassInt(10) + ' don't check that 10 has been passed + recorder.IgnoreArguments() + + ' Second time PassInt to be called. + mockedTestedClass.PassInt(10); + ' check that 1 or 2 is passed + recorder.CheckArguments(Check.IsIn(1,2))) + End Using + + ' run our code + Dim t As TestedClass = New TestedClass + ' This will pass (ignored) + t.passInt(1) + ' This will fail + t.passInt(3) + MockManager.Verify() + End Sub + + + For VB .NET 1.1 see + + + + + + Repeat the last expectation and mocked return values + + + + + For example, lets repeat the expectation for DoSomething 3 times + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // Mock new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // DoSomething to be called. + mockedTestedClass.DoSomething(); + // return 10, 3 times + recorder.Return(10).Repeat(3); + } + + // run our code + TestedClass t = new TestedClass(); + int actual = t.DoSomething(); + Assert.AreEqual(10,actual); + int actual = t.DoSomething(); + Assert.AreEqual(10,actual); + // This will fail as we have one more expectation + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' Mock new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be called. + mockedTestedClass.DoSomething() + ' return 10, 3 times + recorder.Return(10).Repeat(3) + End Using + + ' run our code + Dim t As TestedClass = New TestedClass + Dim actual As Integer = t.DoSomething() + Assert.AreEqual(10,actual); + actual = t.DoSomething() + Assert.AreEqual(10,actual); + ' This will fail as we have one more expectation + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + When using Chained expectations the repeat will repeat ALL the calls in the chain + + Amount of times to repeat the expectation + Use to change more Behavior + + + + Repeat the last expectation and mocked return values for every call + + + + + For example, lets repeat the expectation for DoSomething + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // Mock new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // DoSomething to be called. + mockedTestedClass.DoSomething(); + // always return 10 + recorder.Return(10).RepeatAlways(); + } + + // run our code + TestedClass t = new TestedClass(); + int actual = t.DoSomething(); + Assert.AreEqual(10,actual); + int actual = t.DoSomething(); + Assert.AreEqual(10,actual); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' Mock new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be called. + mockedTestedClass.DoSomething() + ' always return 10 + recorder.Return(10).RepeatAlways() + End Using + + ' run our code + Dim t As TestedClass = New TestedClass + Dim actual As Integer = t.DoSomething() + Assert.AreEqual(10,actual); + actual = t.DoSomething() + Assert.AreEqual(10,actual); + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + When using Chained expectations the repeat will repeat ALL the calls in the chain + + Use to change more Behavior + + + + + + + Create a virtual memory mapped file located in the system page file. + + The name of the file. Prefix it with "Global\" or "Local\" to control its scope between NT services and user applications in Terminal Server scenarios. + Whether you need write access to the file. + The preferred size of the file in terms of bytes. + A MemoryMappedFile instance representing the file. + + + + Create a view of the memory mapped file, allowing to read/write bytes. + + An optional offset to the file. + The size of the view in terms of bytes. + Whether you need write access to the view. + A MemoryMappedFileView instance representing the view. + + + + + Scope of Mock + + + + + + + + + + + + + + + + + + + + + Summary description for TraceData. + + + + + Base Trace Object + + + + + Deserialization constructor. + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Serialization function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Summary description for CompoundCheck. + + + + + TypeMockException is throw when illegal arguments are received by + + For example when trying to return an incorrect type + + + + + + TypeMockException is throw when illegal arguments are received by + + Reason of exception + + + + TypeMockException is throw when illegal arguments are received by + + + + + TypeMockException is throw when illegal arguments are received by + + Reason of exception + Inner Exception + + + + Initializes a new instance of the TypeMockException class with serialized data. + + The SerializationInfo that holds the serialized object data about the exception being thrown. + The StreamingContext that contains contextual information about the source or destination. + + + + Initializes a new instance of the CannotEvaluateWhileRecordingException class with serialized data. + + The SerializationInfo that holds the serialized object data about the exception being thrown. + The StreamingContext that contains contextual information about the source or destination. + + + Used to initiate verification at the end of each test. This class cant + be inherited. + Any method marks with this attribute will call MockManager.Verify after + the test is done. A marked class will do this for any test defined in + it. + + + [TestFixture] + [ClearMocks] // clear all mocks between tests + public TestClass + { + [Test] + [VerifyMocks] // verify the mocks after this tests + void test1() + { + // Set Expectations + + // the test code + } + } + + < TestFixture >_ + < ClearMocks >_ ' clear all mocks between tests + Public class TestClass + < Test >_ + < VerifyMocks >_ ' verify the mocks after this tests + Public Sub test1() + ' Set expectations + + ' the test code + End Sub + End Class + ClearMocksAttribute + MockManager.Verify + + + + Create an instance of the attribute. + when this attribute is specified the mock verification process will be initiated automatically + at the end of the test method (when specified on a class it will be done for each test method) + + + + + Create an instance of the attribute, initializing it with the given timeout. + When a timeout is specified the auto verify will call the verification with timeout process. + + the given timeout (in milliseconds) + + + Called by the framework instead of the original method. This will run the original method and + afterwards will initiate the verification process. + If the test has failed on its own, verification will not be called but all expectations will be cleared + anyway. + The results from activating the original invoker on the test + if verify fails + + + + Get and Set the timeout (in milliseconds) for all expectations to complete + + + + + + ProcessSemaphore is an Inter-Process counting semaphore using Win32 Semaphores. + Semaphores are useful for Inter-Process synchronization and communication. + + All members of this class are thread-safe. + + + + + A counting semaphore is a thread or process synchronization primitive. + Semaphores are useful for Inter-Thread or Inter-Process synchronization and communication, depending on the implementation. + Usually all interfaces members of this type are thread-safe. + + + + + Blocks if no release is signaled or removes a release signal. Enter a critical section. + In theory, this method is often called P() [Dijkstra, dutch: passeeren] + + + + + Blocks if no release is signaled or removes a release signal. Enter a critical section. + In theory, this method is often called P() [Dijkstra, dutch: passeeren] + + The maximum blocking time. Usually an Exceptions is thrown if a timeout exceeds. + + + + Signals a release and allows a blocked thread to continue. Leave a critical section. + In theory, this method is often called V() [Dijkstra, dutch: vrijgeven] + + + + + Instanciate a new Inter-Process semaphore. + + The semaphore's name. + + + + Instanciate a new Inter-Process semaphore. + + The semaphore's name. + The initial count of releases signaled. + + + + Instanciate a new Inter-Process semaphore. + + The semaphore's name. + The initial count of releases signaled. + The maximum count of release signaled. + The maximum time [ms] needed to react to interrupts. + + + + Blocks if no release is signaled or removes a release signal. Enter a critical section. + In theory, this method is often called P() [Dijkstra, dutch: passeeren] + + This member is thread-safe. + + + + Blocks if no release is signaled or removes a release signal. Enter a critical section. + In theory, this method is often called P() [Dijkstra, dutch: passeeren] + + The maximum blocking time. Usually an Exceptions is thrown if a timeout exceeds. + This member is thread-safe. + + + + Signals a release and allows a blocked thread to continue. Leave a critical section. + In theory, this method is often called V() [Dijkstra, dutch: vrijgeven] + + This member is thread-safe. + + + + Don't forget to dispose this object before destruction. + + + + + Typemock Isolator Natural Mocks™ RecordExpectations class helps define the mocked expectations + + + + Typemock Isolator supports the innovative Natural Mocks™ way of defining expectations by recording the expectations. + Natural Mocks™ are Strongly Typed and thus supports Compile Time Checks and Refactoring. + Using Natural Mocks™ it is now much simpler to define and create tests that require isolating other parts of the code. + Although the Natural Mocks™ is easier, it does not cover all the scenarios, and the normal TyepMock.NET way is required. + The two way are compatible and can be used together. + + + + Example of using Natural Mocks™ + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod will be mocked. + TestedClass.MyMethod(10); + } + + // run our code, This will be mocked + TestedClass.MyMethod(10); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod will be mocked. + TestedClass.MyMethod(10) + End Using + + ' run our code, This will be mocked + TestedClass.MyMethod(10) + MockManager.Verify() + End Sub + + + ' Visual Basic .NET 1.1 + <Test()> _ + Public Sub Test() + ' Start mocking + Dim recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + Try + ' MyMethod will be mocked. + TestedClass.MyMethod(10) + Finally + recorder.Dispose() + End Try + + ' run our code, This will be mocked + TestedClass.MyMethod(10) + MockManager.Verify() + End Sub + + + + See and to return different values + + + + + + Start a new recording, CAUTION, as long as the recording object is alive ALL methods will be recorded and not called + + + + CAUTION, as long as the recording object is alive ALL methods will be recorded and not called + + + + + Mock a return value + + The mocked return value + Ability to modify mock Behavior + + + + Example of using Natural Mocks™ Return + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod will be mocked. + TestedClass.MyMethod(); + recorder.Return(5); + } + + // run our code, This will be mocked + int actual = TestedClass.MyMethod(); + Assert.AreEqual(5,actual); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod will be mocked. + TestedClass.MyMethod() + recorder.Return(5) + End Using + + ' run our code, This will be mocked + Dim actual as Integer = TestedClass.MyMethod() + Assert.AreEqual(5,actual) + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + + + + + Set the mocked method to return a mock object with default behavior + + Ability to modify mock Behavior + + The default behavior is: + + All void calls just return + Other Methods will return a default value (0 or null depending on the return type) + Properties will behave like simple properties. + + + + Example of using Natural Mocks™ Return + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod will be mocked. + TestedClass.MyMethod(); + recorder.ReturnDefaultImplementation(); + } + + // run our code, This will be mocked + int actual = TestedClass.MyMethod(); + Assert.AreEqual(0,actual); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod will be mocked. + TestedClass.MyMethod() + recorder.ReturnDefaultImplementation() + End Using + + ' run our code, This will be mocked + Dim actual as Integer = TestedClass.MyMethod() + Assert.AreEqual(0,actual) + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + + + + + Mock a return value + + Function to perform + Ability to modify mock Behavior + + + + Example of using Natural Mocks™ Do + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod will be mocked. + TestedClass.MyMethod(); + recorder.Do(delegate(object[] parameters, object context) + { + return 5; + }); + } + + // run our code, This will be mocked + int actual = TestedClass.MyMethod(); + Assert.AreEqual(5,actual); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + Public Function ReturnValue(ByVal parameters() As Object, ByVal context As Object) As Object + ReturnValue = 5 + End function + End Class + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod will be mocked. + TestedClass.MyMethod() + recorder.Do(AddressOf ReturnValue) + End Using + + ' run our code, This will be mocked + Dim actual as Integer = TestedClass.MyMethod() + Assert.AreEqual(5,actual) + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + + + + + Expect a call and Mock a return value + + The call(s) to be mocked + The mocked return value + Ability to modify mock Behavior + + + + Example of using Natural Mocks™ ExpectAndReturn + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod will be mocked. + recorder.ExpectAndReturn(TestedClass.MyMethod(),5); + } + + // run our code, This will be mocked + int actual = TestedClass.MyMethod(); + Assert.AreEqual(5,actual); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod will be mocked. + recorder.ExpectAndReturn(TestedClass.MyMethod(),5) + End Using + + ' run our code, This will be mocked + Dim actual as Integer = TestedClass.MyMethod() + Assert.AreEqual(5,actual) + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + + + + + Mock throwing an exception + + The exception to throw when the method has been called + See for an example + Ability to modify mock Behavior + + + + Expect a call and mock throwing an exception + + The call(s) to be mocked + The exception to throw when the method has been called + See for an example + Ability to modify mock Behavior + + + + Expect a call but call the original method + + Ability to modify mock Behavior + + + + Example of using Natural Mocks™ CallOriginal + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod will be mocked. + TestedClass.MyMethod(); + recorder.CallOriginal(); + } + + // run our code, This will not be mocked but we verify that it was called + TestedClass.MyMethod(); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod will be mocked. + TestedClass.MyMethod() + recorder.CallOriginal() + End Using + + ' run our code, This will not be mocked but we verify that it was called + TestedClass.MyMethod() + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + + + + + Expect a call but call the original method + + The call(s) to be mocked + Ability to modify mock Behavior + + + + Example of using Natural Mocks™ ExpectAndCallOriginal + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod will be mocked. + recorder.ExpectAndCallOriginal(TestedClass.MyMethod()); + } + + // run our code, This will not be mocked but we verify that it was called + TestedClass.MyMethod(); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod will be mocked. + recorder.ExpectAndCallOriginal(TestedClass.MyMethod()) + End Using + + ' run our code, This will not be mocked but we verify that it was called + TestedClass.MyMethod() + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + + + + + Fail if the call is made + + The call to be mocked + Ability to modify mock Behavior + + + + Example of using Natural Mocks™ FailWhenCalled + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod cannot be called. + recorder.FailWhenCalled(TestedClass.MyMethod()); + } + + // run our code, This will fail + int actual = TestedClass.MyMethod(); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod cannot be called. + recorder.FailWhenCalled(TestedClass.MyMethod()) + End Using + + ' run our code, This will fail + Dim actual as Integer = TestedClass.MyMethod() + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + + + + + Fail when the last call is made + + Ability to modify mock Behavior + + + + Example of using Natural Mocks™ FailWhenCalled + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // MyMethod cannot be called. + TestedClass.MyMethod() + recorder.FailWhenCalled(); + } + + // run our code, This will fail + int actual = TestedClass.MyMethod(); + MockManager.Verify(); + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' MyMethod cannot be called. + TestedClass.MyMethod() + recorder.FailWhenCalled() + End Using + + ' run our code, This will fail + Dim actual as Integer = TestedClass.MyMethod() + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + + + + + Mock the static constructors of the previously created instance + + + By default, Typemock Isolator automatically mocks the static constructors + of instances created inside recording blocks. + These static constructors are activated either when an un-mocked call + is made on the type in another test, or when a new + un-mocked instance from the type is created. + + + + + Instruct the framework to not mock the static constructor of the previously created instance. + In order to stop mocking of all static constructors, us the DefaultBehavior.MockStaticConstructors + + + + + Assign a new value to the given field on the future created object. + + Referance to the field to be assigned. + The value to assign. + + Show how to assign values to a field during the recording mode and how the value is + reflected on the new object created during the test. + + [Test] + [VerifyMocks] + public void FieldAssignmentNatural() + { + FieldClass replacement = new FieldClass(); + using (RecordExpectations recorder = new RecordExpectations()) + { + //create a mock and assign a future value to the intMember + TestedClass mock = new TestedClass(); + recorder.AssignField(ref mock.classField, replacement); + } + //verify that the replaced value was assigned to the newly created instance + TestedClass target = new TestedClass(); + int actual = target.classField.GetHashCode(); + Assert.AreEqual(replacement.GetHashCode(), actual); + } + + + //VB + <Test(), VerifyMocks() > _ + Public Sub FieldAssignmentNatural() + Dim replacement As new FieldClass + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' make all future instances mocked + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be mocked. + ' always return 10 + recorder.AssignField(ref mock.classField, replacement) + End Using + ' verify that the replaced value was assigned to the newly crated instance + Dim target As New TestedClass + Dim actual As Integer = target.classField.GetHashCode() + Assert.AreEqual(Replacement.GetHashCode, actual) + End Sub + + + + + + Assign a new value to the given field on the future created object. + + Referance to the field to be assigned. + The value to assign. + + Show how to assign values to a field during the recording mode and how the value is + reflected on the new object created during the test. + + [Test] + [VerifyMocks] + public void FieldAssignmentNatural() + { + using (RecordExpectations recorder = new RecordExpectations()) + { + //create a mock and assign a future value to the intMember + TestedClass mock = new TestedClass(); + recorder.AssignField(ref mock.intMember, 7); + } + //verify that the replaced value was assigned to the newly created instance + TestedClass target = new TestedClass(); + Assert.AreEqual(7, target.intMember); + } + + + <Test(), VerifyMocks() > _ + Public Sub FieldAssignmentNatural() + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' make all future instances mocked + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be mocked. + mockedTestedClass.DoSomething() + ' always return 10 + recorder.AssignField(ref mock.intMember, 7) + End Using + ' verify that the replaced value was assigned to the newly crated instance + Dim target As New TestedClass + Assert.AreEqual(7, target.intMember) + End Sub + + + + + + Stop RecordExpectations, all methods will be called or mocked + + + + + See + + + + + See + + list of expected parameters and/or parameter checkers + + + + See + + list of expected parameters and/or parameter checkers + + + + See + + Amount of times to repeat the expectation + Use to change mock Behavior + + + + See + + Use to change mock Behavior + + + + Mock all future instances of the type mocked + + + + + Example of using Natural Mocks™ MockAllInstances, + we will always return 10 when DoSomething is called from any TestedClass instance + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // make all future instances mocked + recorder.MockAllInstances = true; + // Mock (all) new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // DoSomething to be mocked. + mockedTestedClass.DoSomething(); + // always return 10 + recorder.Return(10).RepeatAlways(); + } + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' make all future instances mocked + recorder.MockAllInstances = True + ' Mock (all) new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be mocked. + mockedTestedClass.DoSomething() + ' always return 10 + recorder.Return(10).RepeatAlways() + End Using + End Sub + + For VB .NET 1.1 see + + + + + + + Change the verify mode of the next expectations + + + + + Change the default Behavior of Natural Mocks™ + + + The default Behavior of Natural Mocks is + + Repeat once (See ) + Ignore Arguments (See ) + + To change this use DefaultBehavior. + This is useful for chained natural mocks where we require the whole chain to be checked. + + + Example of using Natural Mocks™ repeat always, + we will always return 10 when GetSomething().DoSomething() is called from any TestedClass instance + + [Test] + public void Test() + { + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // CAUTION: ALL calls here are mocked!!! + // make all future instances mocked and all statements repeat + recorder.DefaultBehavior.RepeatAlways(); + // Mock (all) new instance of TestedClass + TestedClass mockedTestedClass = new TestedClass(); + // DoSomething to be mocked. + mockedTestedClass.GetSomething().DoSomething(); + // always return 10 + recorder.Return(10); + } + } + + + ' Visual Basic .NET 2.0 + <Test()> _ + Public Sub Test() + ' Start mocking + Using recorder As New RecordExpectations + ' CAUTION: ALL calls here are mocked!!! + ' make all future instances mocked and all statements repeat + recorder.DefaultBehavior.RepeatAlways() + ' Mock (all) new instance of TestedClass + Dim mockedTestedClass As TestedClass = New TestedClass + ' DoSomething to be mocked. + mockedTestedClass.GetSomething().DoSomething() + ' always return 10 + recorder.Return(10) + End Using + End Sub + + For VB .NET 1.1 see + + + + + + + List of mocked events. + + When more than one instance of the event published is mocked, use the MockedEvent.[index] property. + The first instance to register to the event will be in index 0, the next instance in 1 and so on. + + + + + Since Version 3.7 + + + + + Return the number of mocked events in the list + + + + + Get an that was previously registers. + + The first instance to register to the event will be in index 0, the next instance in 1 and so on. + + The index of the to retrieve + The + + + + IMockedEvent is the Typemock Isolator Event Mocking mechanism, used to fire events to test Event driven applications. + + + + When one instance of the event publisher is mocked, use MockedEvent. + to fire the event. + + [Test] + public void SimulateFiringClick() + { + // Mock the Click Event of the next Button + Mock mockButton = MockManager.Mock(typeof(Button)); + MockedEvent handler = mockButton.ExpectAddEvent("Click"); + + // Create the button and register to the Event + Button button = new(Button); + button.Click += new EventHandler(button_Click); + + // Simulate firing the event + handler.Fire(this, EventArgs.Empty); + // Check that system works... + + MockManager.Verify() + } + + + <Test()> _ + Public Sub SimulateFiringClick() + 'Mock all Click Events of the next Button + Dim buttonMock As Mock = MockManager.Mock(GetType(Button)) + Dim handle As MockedEvent = buttonMock.ExpectAddEvent("Click") + + ' Create the button and register to the Event + Dim button As Button = New Button + AddHandler button.Click, AddressOf button_Click + + ' Simulate firing the event + handle.Fire(Me, EventArgs.Empty) + ' Check that system works... + + MockManager.Verify() + End Sub + /// + When more than one instance of the event published is mocked, use the MockedEvent.[index] property + The first instance to register to the event will be in index 0, the next instance in 1 and so on. + + [Test] + public void SimulateFiringClickOnManyButtons() + { + // Mock all Click Events of the all Buttons + Mock buttonMock = MockManager.MockAll(typeof(Button)); + MockedEvent handle = buttonMock.ExpectAddEventAlways("Click"); + + // create 2 buttons and register to the Click Event + Button button1 = new Button(); + Button button2 = new Button(); + button1.Click += new EventHandler(button_Click); + button2.Click += new EventHandler(button_Click); + + // Simulate firing Click of button1 + handle.Instance[0].Fire(this, EventArgs.Empty); + // Simulate firing Click of button2 + handle.Instance[1].Fire(this, EventArgs.Empty); + // Check that system works... + + MockManager.Verify() + } + + + <Test()> _ + Public Sub SimulateFiringClickOnManyButtons() + 'Mock all Click Events of the all Buttons + Dim buttonMock As Mock = MockManager.MockAll(GetType(Button)) + Dim handle As MockedEvent = buttonMock.ExpectAddEventAlways("Click") + + ' create 2 buttons and register to the Click Event + Dim button1 As Button = New Button + Dim button2 As Button = New Button + + AddHandler button1.Click, AddressOf button_Click + AddHandler button2.Click, AddressOf button_Click + + ' Simulate firing Click of button1 + handle.Instance(0).Fire(Me, EventArgs.Empty) + ' Simulate firing Click of button2 + handle.Instance(1).Fire(Me, EventArgs.Empty) + ' Check that system works... + + MockManager.Verify() + End Sub + + + Since Version 3.7 + + + + + Fire a mocked event. See + + Arguments to pass to the mocked event + The return value of the event + + + + Retrieve the EventHandle + + + Using GetEventHandle can help write type-safe tests by casting the EventHandle to the correct Event Type + Example + + EventHandler fire = handle.GetEventHandle() as EventHandler; + fire(this, EventArgs.Empty); + + + Dim fire As EventHandler = handle.GetEventHandle() + fire(Me, EventArgs.Empty) + + + The Event + + + + Create a presentable name from generic types + also replace the name of types we dynamically create with the original type name + + + the clean name + + + + chek to see if type can be assigned a null value + + the given type + true if type can be assigned a null value, false if not + + + + check if there is a method of the given name on this type + (for now will also check for static methods) + + + + true if there is at least one method by that name + + + + check to see if there is a STATIC method on the given type + + the type + the method name + true if there is at least one method method + + + + locate a method with the given name on the type + (for now consider static method as well) + + the given type + the method name + a MethodBase object representing the first found method + if no matching method is found + + + + locate a STATIC method with the given name on the type + + the given type + the method name + a MethodBase object representing the first found method + if no matching method is found + + + + search for a method answering all the given criteria: + name + generic method signature (e.g. SomemMthod[X,Y]) + Matching return type (can be void also) + For now will incldue static method in its search. + + the given type + the method name + the supplied return type + the generic signature list + a MethodBase for a method answering all of the above conditions + if no matching method is found + + + + search for a STATIC method answering all the given criteria: + name + generic method signature (e.g. SomemMthod[X,Y]) + Matching return type (can be void also) + + the given type + the method name + the supplied return type + the generic signature list + a MethodBase for a method answering all of the above conditions + if no matching method is found + + + + Constructs a completely bounded type. + + he given type we need to constructs + the generic arguments from the associated call + the generic arguments from the associated class + a fully binded type + + + + This will return the bounded generic type in which the method is declared + this can either be the type of the context instance, or one of his ancestors types + + the instance on which the call was made + the method call data + The vounded type on which the call was made + + + + This returns the generic arguments of the type associated with the call. + i.e. the bounded type on which the call was issued + + this either contains the instance on which the call was made, + the TypeParams of the class in cases of generic static calls or null (regular static calls) + the call method + + + + + Filter out the methods with matching return types + + + + + Filter out the methods with matching generic signature + + + + + Filter out static methods returning only instance methods + + + + + Filter out instance methods returning only instance methods + + + + + will find the m ethod return type in the generic signature + + + + + return true if the types matches according to our logic: + 1) DynamicReturnValue always match + 2) if user gave a null value we match if the method return type can be assigne da null value + 3) do a smart generic matching bound generic types + 4) unbound generic types always match + + + + + do smart match of for a generic type by comparing the generic type definition + to the generic type definiton of the other class along with his entire class hirarchy or implemented interfaces + + + + + collect all methods on the type any of his base class or implemented interfaces with the given name + + + + + convert the type list into a nice presentable string + + + + + build a smart exception string based on the scenario + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Summary description for AutoUpdater. + + + + + Set next check date + + + + + Run the process + + + + + + Run the process + + + + + + Run the process + + + + + + Start Auto Updater process + + + + + + gets typemock key from registry - 32/64 bit + + + + + + Perform Behavior tweaking on methods rather then the whole mocked type + + + + + + + + Can set one method of the mock to be Strict + + + By default Mocked Types are NOT strict this mean that if a call to a mocked + method was not expected the normal code is executed. + Mocked Types can be made strict and fail if an unexpected call is made + + [Test] + public void Test() + { + // Start mocking TestedClass + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + // No expectations, the following will fail because passInt() is + // set to Strict + mock.MethodSettings("passInt").IsStrict = true; + t.passInt(10); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub Test() + { + ' Start mocking TestedClass + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + ' No expectations, the following will fail because passInt() is + ' set to Strict + mock.MethodSettings("passInt").IsStrict = True + t.passInt(10) + MockManager.Verify() + End Sub + + + + + + + + Event that is fired after a mocked method is called and after validation is performed + + + + To set an event for all calls see Mock. + + + // This will be called when a mocked method is called + private void SuccessEvent(object sender,MockMethodCallEventArgs e) + { + Assert.AreEqual(typeof(TestedClass),e.CalledType); + Assert.AreEqual("getVar",e.CalledMethodName); + Assert.AreEqual(0,e.SentArguments.Length); + Assert.AreEqual(0,e.ExpectedArguments.Length); + Assert.AreEqual(false,e.WillThrowException); + Assert.AreEqual(null,e.Exception); + Assert.AreEqual(5,e.ReturnValue); + Assert.AreEqual(true,e.HasPassedValidation); + } + [Test] + public void SimpleEventSuccess() + { + Mock mock = MockManager.Mock(typeof(TestedClass),false); + TestedClass t = new TestedClass(); + + mock.ExpectAndReturn("getVar",5); + // set event listener + mock.MethodSettings("getVar").MockMethodCalled += new MockMethodCalledEventHandler(SuccessEvent); + // the event will be called + Assert.AreEqual(5,t.getVar()); + mock.Verify(); + } + + + ' This will be called when a mocked method is called + Public Shared Sub SuccessEvent(ByVal sender As Object, ByVal e As MockMethodCallEventArgs) + Assert.AreEqual(GetType(TestedClass),e.CalledType) + Assert.AreEqual("getVar",e.CalledMethodName) + Assert.AreEqual(0,e.SentArguments.Length) + Assert.AreEqual(0,e.ExpectedArguments.Length) + Assert.AreEqual(False,e.WillThrowException) + Assert.AreEqual(Nothing,e.Exception) + Assert.AreEqual(5,e.ReturnValue) + Assert.AreEqual(True,e.HasPassedValidation) + End Sub + + <Test()> _ + Public Sub SimpleEventSuccess() + Dim t As TestedClass = new TestedClass + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + + mock.ExpectAndReturn("getVar",5) + ' set event listener + AddHandler mock.MethodSettings("getVar").MockMethodCalled, AddressOf SuccessEvent + + ' the event will be called + Assert.AreEqual(5,t.getVar()) + mock.Verify() + End Sub + + + + + + + VerifyException is throw when set expectations are not met (see ). + + For example when parameters passed are not the ones we expect. When a method is not called or is called + too often (in Strict mode) + + + + + + VerifyException is throw when a Mocked call is not as expected + + + + + VerifyException is throw when a Mocked call is not as expected + + Reason of exception + + + + VerifyException is throw when a Mocked call is not as expected + + Reason of exception + Inner Exception + + + + For serialization + + The SerializationInfo that holds the serialized object data about the exception being thrown. + The StreamingContext that contains contextual information about the source or destination. + + + + Get only base message + + + + Some Constants used to communicate with weaver. + The name under which we store global types + + + stores all the types that has been mocked. + + + + Adds the type with all its base classes to the mocked list + + The new type that is being mocked + + + + Clear The list from all mocked types + + + + + Determines whether a specific type has been mocked. + + the name of the type + true if the type has been mocked + + + + Determines whether a specific type has been mocked. + + the type to look for + true if the type has been mocked + + + + + TypeParams is a utility class to handle generics + + + + + Internal class to handle constructors + + + + + + Get the System.Type from RuntimeTypeHandle array + + Type[] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contain the list of all types that their cctor was encountered during + the recording phase and therefore was not activated. + + + + + This class helps strongly type generic method types when using Reflective Mocks + + + Following is an example of using Generic + + + [Test] + public void MockGenericMethod() + { + Mock mock = Mock<MockedClass>.MockNextInstance(); + mock.AlwaysReturn("Method", 11, Generic.Method<int>()); + MockedClass test = new MockedClass(); + Assert.AreEqual(11, test.Method<int>(1)); + } + + + <Test()> _ + Public Sub MockGenericMethod() + Dim mock As Mock = Mock(Of MockedClass).MockNextInstance() + mock.AlwaysReturn("Method", 11, Generic.Method(Of Integer)()); + Assert.AreEqual(11, test.Method(Of Integer)(1)); + End Sub + + + + + + + Define Expectations of Generic Methods with 1 generic parameter + + Method Generic Parameter + Types of generic parameters + + See for an example + + + + + Define Expectations of Generic Methods with 2 generic parameter + + Method Generic Parameter 1 + Method Generic Parameter 2 + Types of generic parameters + + See for an example + + + + + Define Expectations of Generic Methods with 3 generic parameter + + Method Generic Parameter 1 + Method Generic Parameter 2 + Method Generic Parameter 3 + Types of generic parameters + + See for an example + + + + + Define Expectations of Generic Methods with 4 generic parameter + + Method Generic Parameter 1 + Method Generic Parameter 2 + Method Generic Parameter 3 + Method Generic Parameter 4 + Types of generic parameters + + See for an example + + + + + Summary description for StringCheck. + + + + + clear all expectations from table. + + + + + Find if type has expectations. + + The type to look for + true if type has expectations, false otherwise + + + + If type is abstract insert "Mock" at the start of type name. + + + + + + + + Returns the Expectation for the given type. + + The type + The expectation for the type + + + + Returns the Expectation for the given type. + + the name of the type to look for + + + + + Create expectations for the given type + + The type + + + + returns all types that has expectations. + + type array containing list of types that has expectations. + + + + Verify that all expectations in table has been met + + String describing the verify problem, an empty string if all expectations has been met + + + + Verify that all expectations in table has been met + + the timeout in Millisecond + String describing the verify problem, an empty string if all expectations has been met + + + + checks if type has any expectations on it (used to decide if cctor should be invoked) + + the type to check + true if user set an explicit expecation on any of the methods + + + + Initializes a new instance of the ChainManager class. + + + + + Class that contains information about the called instance + + + + + Reference to the mocked object instance, or null if the method is static + + The instance. + + + + Array of parameters passed to mocked method + + The parameters. + + + + Summary description for InternalCheck. + + + + Create a new instance of the MockScope that will activate the mock + verification process on its dispose. + + + + [Test] + void TestMethod1() + { + using (new MockScope()) + { + //The Test code + } + } + + <Test()> _ + Public Sub TestMethod1() + Using Scope As New MockScope + ' The Test code + End Using + End Sub + + + + + + + stores the timeout to pass to verify + + + + Create a new instance of the MockScope that will activate the mock + verification process on its dispose. + + + + [Test] + void TestMethod1() + { + using (new MockScope()) + { + //The Test code + } + } + + <Test()> _ + Public Sub TestMethod1() + Using Scope As New MockScope + ' The Test code + End Using + End Sub + + + + + + + Initializes a new instance of the class, that will call + the VerifyWithTimeout with the given timeout. + + The millisecond timeout. + Create a new instance of the MockScope that will activate the mock + verification process on its dispose. + + + + [Test] + void TestMethod1() + { + using (new MockScope(1000)) + { + //The Test code + } + } + + <Test()> _ + Public Sub TestMethod1() + Using Scope As New MockScope(1000) + ' The Test code + End Using + End Sub + + + + + + Activate the verification process + + + + + Thrown when call was made to a mock object but wasn't registered + see: + + + + + Flags that define the behavior of Arbitrary (not expected) calls. + The default is the Methods of Abstract and Interfaces are Strict and Arbitrary calls fail + while Arbitrary Methods of concrete classes are allowed. + + + When testing for mock interactions there are times when the default behavior needs to be changed, + the StrictFlags define which arbitrary methods we allow. + + When allowing arbitrary abstract methods (methods created dynamically by Typemock Isolator using or ), + Typemock Isolator create the following default behavior: + 1. All void calls just return + 2. Other Methods will return 0 or null depending on the return type + 3. Properties will behave like normal properties + + To set only one method to strict use: or + + + + + + All methods are strict and if an arbitrary method is called the test will fail + This is equivalent to : StrictFlags.InstanceMethods | StrictFlags.StaticMethods + + + + + Instance methods are strict and if an arbitrary instance method is called the test will fail + + + + + Static methods are strict and if an arbitrary static method is called the test will fail + + + + + This is the default. Methods of Abstract classes and Interfaces are Strict and Arbitrary calls fail + while Arbitrary Methods of concrete classes are allowed. + + + + + Methods are not strict and arbitrary methods are allowed + + + + + Scope of Constructors to Mock. see MockManager. + + + .NET code has support for two constructors the first is the normal constructor that is run + every time a new instance is created and the other is the static constructor that is run the + first time the object is referenced too. This constructor sets up all the static fields. + + + + + Both regular constructor and static constructors should be mocked out + + + + + Only regular constructors should be mocked out + + + + + Both Constructors will run as normal and wont be mocked + + + + + MockManager is the Typemock Isolator manager class, this class is the entry point + for creating type mocks + + + + Mock object tests replace domain dependencies with mock implementations used only + for testing. This strategy does, however, present a technical challenge in certain + situations, as the Mock objects can only mock interfaces, and these mocks have to + be passed to the function, so no internal instantiation of classes can be mocked + + + Typemock Isolator to provide "type" mock objects. No concrete mock objects are + actually created, but rather Typemock Isolator is used to weave interceptions into + all code that is not part of the class under test. In this way, every method call + is intercepted. If the method call is one for which mock data has been declared, + then that mock data is returned in place of the actual method being run. + + For example a LoginView (the class being tested) which as properties of userID and + password that are set prior to calling a validate method. Following that call, the + status attribute will be set to a string value that is ultimately displayed to the + user. The LoginView is responsible for interpreting the status code + (USER_VALID, NO_PASSWORD, NO_USERID, INVALID_USER) that is returned from an + AccessController, to determine the status message to display. + + + + public string Validate() + { + AccessController controller = new AccessController(); + AccessStatus status = controller.Login(m_UserID,m_Password); + switch (status) + { + case USER_VALID: + ... + } + return returnStatus; + } + + + Public Function Validate() As String + Dim controller As AccessController = New AccessController + Dim status As AccessStatus = controller.Login(m_UserID,m_Password) + Select Case status + Case USER_VALID + ... + End Select + Validate = returnStatus + } + { + + + However, the LoginView class makes use of the login service provided by the + AccessController class. The AccessController will probably itself + use other components to authenticate the user. For the tests to work it would + be necessary to create some test users in the system. The tests that were written + to test the behavior of LoginView would in fact also be testing the + AccessController, which should of course have its own suite of tests. + + + The behavior we are trying to test here is to determine that the user gets the + correct status message for the different cases of invalid or missing user + credentials returned by the AccessController and not the actual validation of + those credentials. + + + Using Typemock Isolator We can intercept the AccessController and + return our own value + + + [Test] + public void ValidateValidUser() + { + //Mock all invocation of AccessController, all calls to this class, are + //intercepted. + Mock mock = MockManager.Mock(typeof(AccessController)); + + //We expect that the login method will be called (once) and we will return + //AccessStatus.INVALID_USER. + mock.ExpectAndReturn("Login", AccessStatus.INVALID_USER); + + LoginView view = new LoginView(); + view.setUserID("jane"); + view.setPassword("passAugust"); + // run the method being tested + view.Validate(); + Assert.AreEqual("login successful", view.Status); + + // Verify that all the expected calls have actually been called. + MockManager.Verify(); + } + + + <Test()> _ + Public Sub ValidateValidUser() + ' Mock all invocation of AccessController, all calls to this class, are + ' intercepted. + Dim mock As Mock = MockManager.Mock(GetType(AccessController)) + + ' We expect that the login method will be called (once) and we will return + ' AccessStatus.INVALID_USER. + mock.ExpectAndReturn("Login", AccessStatus.INVALID_USER) + + Dim view As LoginView = New LoginView + view.setUserID("jane") + view.setPassword("passAugust") + ' run the method being tested + view.Validate() + Assert.AreEqual("login successful", view.Status) + + ' Verify that all the expected calls have actually been called. + MockManager.Verify() + End Sub + + + + + To enable mock manager do one of the following + + + Run mocking_on.bat + + + Run Typemock Isolator [application] + + + Enable Visual Studio Plugin + + + + + + + + Strong Name for Typemock Isolator Dynamic Objects can be used when mocking internal interfaces + Use for [assembly: InternalsVisibleTo(MockManager.DynamicMocksAssembly)] + This will work for both regular and signed assemblies + When you don't want to reference TypeMock.dll use the following: + [assembly: InternalsVisibleTo("DynamicMockAssembly,PublicKey=0024000004800000940000000602000000240000525341310004000001000100ab8e3015b99a732d20ecb2a29fb3f54288a8a614896e7c5091d7b9045368fe6b8bfcc72dce4f01b71281eb4e380dcb709c83a5042a54c684a4711248c078fefb01bcdb09a6ce252e0304ed08c6e4ddf69212e3d0a770d953572e3c474fc08fe3bdbb2fad97b32c6045c08f34466dc8e07bd255d3dbc72408dce6859edb4b04bf")] + + + + mean that we are in the implementation of the decoration code + + + + + Disallow creation on instance + + + + + Stores all classes (with all inheriteance hirarchy) that user has requested to mock. + + + + + Stores counters for all method calls + + + + + Stores counter for all method calls in the form of MethodBase + + + + + Stores All expectations + + + + + + Initialize the MockManager + This is called automatically + + Defaults to collect call information ONLY for mocked classes + + + + + Defaults to collect call information ONLY for mocked classes and + not verbose + + + + + Manually set Call Collection and verbose behaviors + + if set, Typemock Isolator collects call information + for all classes, this can later be verified using + + + + Clears all expectations and mocks + + + There are times when you want to clear all the expectations of all the mocks. + For example, if you call in the [TearDown] method, but a + test failed and you don't want to Verify to cause more test failures. + + This is called automatically after . + (unless is DontClear + + + + + + Create a new Mock to intercept and mock calls made on the next instance of a type. + + + The Type needed to be mocked + New Mock Controller to register expectations + Will be throw if an Interface or Abstract Class is + being Mocked, and if a type is being Mocked twice + + Automatically mock constructors as well, i.e. constructer code will NOT be called + + + + + Create a new Type Mock to intercept and mock calls made on the next instance of a type, + with ability to decide if Constructors should be mocked or not (default is to mock constructors) + + The Type needed to be mocked + Should constructors be mocked + New Mock Object to control expectations + Will be throw if an Interface or Abstract Class is + being Mocked, if a type is being Mocked twice, or if mocking restricted types (NUnit,TypeMock) + Will be throw if MockManager is not Initialized + + + + + Create a new Type Mock to intercept and mock calls made on the next instance of a type, + with ability to define the scope of mocked Constructors (default is to mock all constructors) + + The Type needed to be mocked + Scope of constructors to be mocked + New Mock Controller to register expectations + Will be throw if an Interface or Abstract Class is + being Mocked, if a type is being Mocked twice, or if mocking restricted types (NUnit,TypeMock) + + + + + Create a new Mock to intercept and mock all calls made on all instances of the mocked type. + + + Each Type can be mocked only once. There is actually no need to mock a type more than once, + all new objects are mocked as well. + + + The Type needed to be mocked + New Mock Controller to register expectations + Will be throw if an Interface or Abstract Class is + being Mocked, and if a type is being Mocked twice + + Automatically mock constructors as well, i.e. constructer code will NOT be called + + + + + Create a new Type Mock for all instances of the type, with ability to decide if Constructors should be mocked or not + + The Type needed to be mocked + Should constructors be mocked + New Mock Object + Will be throw if an Interface or Abstract Class is + being Mocked, if a type is being Mocked twice, or if mocking restricted types (NUnit,TypeMock) + + + + Create a new Type Mock for all instances of the type, with ability to to define the scope of mocked Constructors (default is to mock all constructors) + + The Type needed to be mocked + Scope of mocked constructors + New Mock Controller to register expectations + Will be throw if an Interface or Abstract Class is + being Mocked, if a type is being Mocked twice, or if mocking restricted types (NUnit,TypeMock) + + + + Intercept and mock calls made on the next new instance of TMockedType. + + Mock Controller to define behavior + + The Constructor will be mocked!. + + + [Test] + public void MockTestedClass() + { + Mock mock = MockManager.Mock<TestedClass>(); + mock.ExpectCall("SomeMethod"); + + TestedClass test = new TestedClass(); // This instance is mocked + test.SomeMethod(); // the method is not called + + MockManager.Verify(); // Make sure that all expected calls where made + } + + + <Test()> _ + Public Sub MockTestedClass() + Dim mock As Mock = MockManager.Mock(Of TestedClass)() + mock.ExpectCall("SomeMethod") + + Dim test As TestedClass = New TestedClass ' This instance is mocked + test.SomeMethod() ' the method is not called + + MockManager.Verify() ' Make sure that all expected calls where made + End Sub + + + + + + + + Intercept and mock calls made on the next new instance of TMockedType, with constructor behavior control + + Scope of constructors to be mocked + Mock Controller to define behavior + + + + + + + Intercept and mock calls made on the all instance of TMockedType. + + Mock Controller to define behavior + + The Constructor will be mocked! + + + [Test] + public void MockTestedClass() + { + Mock mock = MockManager.MockAll<TestedClass>(); + mock.AlwaysExpect("SomeMethod"); + + TestedClass test = new TestedClass(); // all instances are mocked + test.SomeMethod(); // the method is not really called + + MockManager.Verify(); // Make sure that all expected calls where made + } + + + <Test()> _ + Public Sub MockTestedClass() + Dim mock As Mock = MockManager.MockAll(Of TestedClass)() + mock.AlwaysExpect("SomeMethod") + + Dim test As TestedClass = New TestedClass ' all instances are mocked + test.SomeMethod() ' the method is not really called + + MockManager.Verify() ' Make sure that all expected calls where made + End Sub + + + + + + + + Intercept and mock calls made on the all instance of TMockedType, with constructor behavior control + + Scope of constructors to be mocked + Mock Controller to define behavior + + + + + + + Check if a type is mocked (with MockAll or instance mocks) + + Type to check + true when the type is mocked + + + + + + + + + + Check if a type is mocked for all instances + + Type to check + true when the type is mocked for all instances + + + + + + + + + + + Returns the mock for all instances of a type, or null if it is not mocked + + Type to return the mock + The mock + + + + + + + + + + + + Returns all mocks for TMockedType + + Type being mocked + The Mocks + + + + + Returns the mock associated with a specific instance + + Type of the instance being mocked + The instance to get the mock of + If a Mock is associated with the provided instance, returns it. Otherwise, returns null + + Identify a specific mock when using Natural Mocks + + [Test] + public void GetMockOfSpecificInstance() + { + using(RecordExpectations rec = RecorderManager.StartRecording()) + { + TestClass instance1 = new TestClass(); + TestClass instance2 = new TestClass(); + TestClass instance3 = new TestClass(); + + Mock mock2 = MockManager.GetMockOf(instance2); + mock2.ExpectAndReturn("SomeMethod", null); + } + } + + + + + + Returns all instance mocks for TMockedType + + Type being mocked + The Mocks + + + + + Returns all instances mock of TMockedType + + Type being mocked + The Mock + + + + + Check if a type is mocked (with MockAll or instance mocks) + + Type being mocked + true when the type is mocked + + + + + Check if a type is mocked for all instances + + Type being mocked + true when the type is mocked for all instances + + + + + Returns all mocks for a type + + Type to return the mock + The mock + + + + + + + + + + + + Returns all mocks + + All the mocks + + You can use Mock. to analyse what type is being mocked + + + + + + + + + + + Returns all types that are mocked + + List of mocked types + + + + + + + + + + + Returns a list of instance mocks of a type + + Type to return the instance mocks + Array of mocks + + + + + + + + + + + Create a new Dynamic Mock Object and mock all future calls made on the mocked type. + + + When mocking Interfaces and Abstract classes a new class is created, for concrete classes, a class is instantiated + + + Mocked Objects are Strict by default, unless they are concrete classes + + + Example of using Typemock Isolator to create a mock object for IList + + + [Test] + public void ValidateValidUser() + { + //Create new Mock Object for IList, all calls to this class, are + //intercepted. + MockObject mock = MockManager.MockObject(typeof(IList)); + + // We expect that the Count parameter will be called (once) and we will return 4 + mock.ExpectGet("Count", 4); + // Get our mocked OBJECT + IList list = mock.Object as IList; + + // lets just run it, normally the Object will be passes as a parameter to a tested class + Assert.AreEqual(4, list.Count); + + // Verify that all the expected calls have actually been called. + MockManager.Verify(); + } + + + <Test()> _ + Public Sub ValidateValidUser() + ' Create new Mock Object for IList, all calls to this class, are + ' intercepted. + Dim mock As MockObject = MockManager.MockObject(GetType(IList)) + + ' We expect that the Count parameter will be called (once) and we will return 4 + mock.ExpectGet("Count", 4) + ' Get our mocked OBJECT + Dim list As IList = mock.Object + + ' lets just run it, normally the Object will be passes as a parameter to a tested class + Assert.AreEqual(4, list.Count) + + ' Verify that all the expected calls have actually been called. + MockManager.Verify() + End Sub + + + + + The Type needed to be mocked + Argument for constructor of concrete types, this is ignored for interfaces + New MockObject Object + + Automatically mock constructors as well, i.e. constructer code will NOT be called + + + + + Create a new Dynamic Mock Object with ability to decide if Constructors should be mocked or not + + The Type needed to be mocked + Should constructors be mocked + New MockObject Object + Will be throw if a Generic Type Class is + being Mocked + + + + + Create a new Dynamic Mock Object with ability to define the scope of mocked Constructors (default is to mock all constructors) + + The Type needed to be mocked + Scope of mocked constructors + Argument for constructor of concrete types, this is ignored for interfaces + New MockObject Object + Will be throw if a Generic Type Class is + being Mocked + + + + Create an instance of TMockedType and mock calls made on the instance. + + Mock Controller to define behavior + + The Constructor will be mocked!. + + To activate the constructor and send specific arguments use + + + + [Test] + public void MockTestedClass() + { + MockObject<TestedClass> mockControl = MockManager.MockObject<TestedClass>.Create(); + mockControl.ExpectCall("SomeMethod"); + + TestedClass mockedInstance = mockControl.Object; // grab actual instance + mockedInstance.SomeMethod(); // the method is not called + + MockManager.Verify(); // Make sure that all expected calls where made + } + + + <Test()> _ + Public Sub MockTestedClass() + Dim mockControl As MockObject(Of TestedClass) = MockManager.MockObject(Of TestedClass)() + mockControl.ExpectCall("SomeMethod") + + Dim mockedInstance As TestedClass = mockControl.Object ' grab actual instance + mockedInstance.SomeMethod() ' the method is not called + + MockManager.Verify() ' Make sure that all expected calls where made + End Sub + + + + + + + + Create an instance of TMockedType and mock calls made on the instance, while controlling the constructor + + Scope of mocked constructors + Mock Controller to define behavior + + For an example see + + + + + + Create an instance of TMockedType and mock calls made on the instance, while sending constructor arguments + + Argument for constructor of concrete types, this is ignored for interfaces + Mock Controller to define behavior + + For an example see + + + + + + Create an instance of TMockedType and mock calls made on the instance, while controlling the constructor and sending constructor arguments + + Scope of mocked constructors + Argument for constructor of concrete types, this is ignored for interfaces + Mock Controller to define behavior + + For an example see + + + + + + Same as MockObject but doesn't check for mocked while locked + + + + + + + + + Use this type when mocking global functions + + + This is an example of how to mock global functions in C++ + + + // Managed C++ + namespace TestWithCpp + { + int globalFunction(int a) {return a;} + } + + And the test + + // Managed C++ + [Test] + void Global() { + Mock* mock = MockManager::MockGlobalFunctions(); + // Notice the '.' and NOT '::' !!! + mock->ExpectAndReturn("TestWithCpp.globalFunction",__box(5)); + Assert::AreEqual(__box(5), __box(globalFunction(4))); + } + + + + New Mock Object + + + + Verify all mocked types + + + Part of Test Driver Development and Mock Methodology is being sure that ALL our + expected calls where actually called. This should always be the final part of the test + If some methods that we expected to be called where not called this will fail the test. + + Using we can also define, that calls to methods that where + not expected, will fail the test too. + + + Mocked static members are verified only when the last instance of a type is Verified. + + + + + + Wait with timeout (5 seconds) for all expected methods to be called + + + VerifyWithTimeout will wait for all expectations to be called. If the Timeout is triggered + the test will fail. + Part of Test Driver Development and Mock Methodology is being sure that ALL our + expected calls where actually called. There are cases when mocks are called in a-synchronic + code or are encapsulated in a try catch block and errors are not thrown to testing method. + In these cases using VerifyWithTimeout will enable us to validate our code and return as soon as + the expected methods are called without needing to add Pause statements + + + + [Test] + public void TestCallsInOtherThread () + { + // Let mock the product - it will not mock constructors; + Mock productMock = MockManager.Mock(typeof(Product),Constructor.NotMocked); + // CalculatePrice will return 10 - expect 10 as argument + productMock.ExpectAndReturn("CalculatePrice",10F).Args(10); + // our method will be called in a new thread + Thread theThread = new Thread(new ThreadStart(RunWithWait)); + theThread.Start(); + // If we use Verify we dont know when the thread will actually be called + // Here we WAIT for the mocked methods to be called, or the timeout. + // Default timeout is 5000 milliseconds + MockManager.VerifyWithTimeout(); + } + + + <Test()> _ + Public Sub TestCallsInOtherThread() + ' Let mock the product - this will mock the next invocation of Product, + ' it will mock constructors too so our price will be 0 + Dim productMock As Mock = MockManager.Mock(GetType(Product), Constructor.NotMocked) + ' CalculatePrice will return 10 - expect 10 as argument + productMock.ExpectAndReturn("CalculatePrice", 10.0F).Args(10) + ' our method will be called in a new thread + Dim theThread As Thread = New Thread(AddressOf RunWithWait) + theThread.Start() + ' If we use Verify we dont know when the thread will actually be called + ' Here we WAIT for the mocked methods to be called, or the timeout. + ' Default timeout is 5000 milliseconds + MockManager.VerifyWithTimeout() + End Sub + + + + + + + Wait with timeout (im milliseconds) for all expected methods to be called + + + VerifyWithTimeout will wait for all expectations to be called. If the Timeout is triggered + the test will fail. + Part of Test Driver Development and Mock Methodology is being sure that ALL our + expected calls where actually called. There are cases when mocks are called in a-synchronic + code or are encapsulated in a try catch block and errors are not thrown to testing method. + In these cases using VerifyWithTimeout will enable us to validate our code and return as soon as + the expected methods are called without needing to add Pause statements + + + + [Test] + public void TestCallsInOtherThread () + { + // Let mock the product - it will not mock constructors; + Mock productMock = MockManager.Mock(typeof(Product),Constructor.NotMocked); + // CalculatePrice will return 10 - expect 10 as argument + productMock.ExpectAndReturn("CalculatePrice",10F).Args(10); + // our method will be called in a new thread + Thread theThread = new Thread(new ThreadStart(RunWithWait)); + theThread.Start(); + // If we use Verify we dont know when the thread will actually be called + // Here we WAIT 1000 milliseconds for the mocked methods to be called, or the timeout. + MockManager.VerifyWithTimeout(1000); + } + + + <Test()> _ + Public Sub TestCallsInOtherThread() + ' Let mock the product - this will mock the next invocation of Product, + ' it will mock constructors too so our price will be 0 + Dim productMock As Mock = MockManager.Mock(GetType(Product), Constructor.NotMocked) + ' CalculatePrice will return 10 - expect 10 as argument + productMock.ExpectAndReturn("CalculatePrice", 10.0F).Args(10) + ' our method will be called in a new thread + Dim theThread As Thread = New Thread(AddressOf RunWithWait) + theThread.Start() + ' If we use Verify we dont know when the thread will actually be called + ' Here we WAIT 1000 milliseconds for the mocked methods to be called, or the timeout. + MockManager.VerifyWithTimeout(1000) + End Sub + + + + Time to wait for all expected methods to be called + + + + Stops Type Mock Insertion, this is called from + + + + + Return the amount of times a method has been called + + + Can be used as part of a validation. + + In the following example we validate that the doSomething() Method has been called 3 times, + while keeping the original functionality (not mocked) + + + [Test] + public void Test() + { + // init collecting on + MockManager.Init(true); + TestedClass t = new TestedClass(); + t.doSomething(); + t.doSomething(); + t.doSomething(); + Assert.AreEqual(3,MockManager.CalledCounter("TestClassLibrary.TestedClass","doSomething")); + } + + + <Test()> _ + Public Sub Test() + ' init collecting on + MockManager.Init(true) + Dim t As TestedClass = New TestedClass + t.doSomething() + t.doSomething() + t.doSomething() + Assert.AreEqual(3,MockManager.CalledCounter("TestClassLibrary.TestedClass","doSomething")) + End Sub + + For Properties and Indexers see , + and + + Calls from Types of the System.* namespace will not be collected until the type is mocked + + + String representation of Type + String representation of Method + Number of times the method has been called + + + + Return the amount of times a method has been called + + The type we want count one of its methods + String representation of Method + Number of times the method has been called + + + + Return the amount of times a method has been called + + The type we want count one of its methods + String representation of Method + Generic parameters list of the method + Number of times the method has been called + + + + Return the amount of times a method has been called + + + String representation of Method + Number of times the method has been called + + + + Return the amount of times a method has been called + + + String representation of Method + Generic parameters list of the method + Number of times the method has been called + + + + Return the amount of times a property has been called + + + See + + String representation of Type + String representation of the Property + Number of times the property has been called + + + + Return the amount of times a property has been set + + + See + + String representation of Type + String representation of the Property + Number of times the property has been set + + + + Return the amount of times an indexer has been called + + + See + + String representation of Type + Number of times the indexer has been called + + + + Part of Message and message will concatenated in "About" in order + to show user exact message + + + + + + + Part of Message and message will concatenated in "About" in order + to show user exact message + + + + + + + + Part of Message and message will concatenated in "About" in order + to show user exact message + + + + + + + Return Typemock Isolator version + + + + + Obsolete, use running options instead, + When set Typemock Isolator creates a log-file + + + Creates a log-file called TypeMock.out in the application directory + This is mainly for debugging Typemock Isolator itself, it is also possible to set the TMOCK_VERIFY environment + variable to 1, before running the executable + The log-file logs the code weaving process + + + + + When set Typemock Isolator collects data on ALL method entries, this can then be verified + using + + + + + Check if Typemock Isolator is initialized + + + + + Obsolete. Argument validation is now done both on calling the method and during Verify automatically. + Postpone throwing validation errors till is called + + + Using ValidateArgsOnVerify, validation errors are thrown after Verify is called. + This is useful if the validation is done in another thread and you want the thread to continue. + When Verify is called all argument validations are shown too. + + The flag will be deleted in future + + + + Obsolete, use Check. instead, + Provided for backward compatibility + + + + + + If CONTINUE_WITH_METHOD is returned the mocked method will continue with + normal execution. This is an un-mocked expectation that will verify that a method is called only + without mocking the method. + + Using handling ref and out parameters in un-mocked mode is tricky as the method is run as normal. See + + + + + Connect to Tracer. These API's might change do not use. + + + + + Internal Tracer Class that communicates with the Tracer GUI. + + + + + Return id Trace client is running - this is used internally and might change without notice + + + + + + Internal use only. + Used as a remotable tracer object. The tracer will create this object and we will send + our data through it. + + + + + Send data to the server. + + + + + + This event must be setup to work. + + + + + Has Server Loaded. + + + + + Used to hook Tracer (Server) + + + + + + + This is to wrap all classes and use our own Hash code. + Or else it might lead to stack overflow + + + + + returns the mocked object instance + + + + + This is to wrap all classes and use our own Hash code. + Or else it might lead to stack overflow + + + + + returns the mocked object instance + + + + + Expectations handles the instance and static and mock all + This is really a TypeExpectations + + + + + Check if method is in the expectation table + + + + + for static constructors + + + + + + Check Parameters and return mocked value + + + + + Verify mocked type + + + + + Find the mock object that was created during the recording of the given mock object + + + + + + + should be true only if MockAll behavior has been set for a struct through AAA + + + + + This delegate is called when a method call is detected. Its implementation can be a filter that + decides whether the method call will be intercepted, not intercepted, or analyzed by Isolator + + + + + This delegate is called after a method has been intercepted. Its implementation can be a filter + that decides how to handle the call: return a custom value, throw an exception, skip the method + altogether, or let Isolator decide + + + + + Summary description for About. + + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + Arguments received in custom parameter checker see ( + + + + + + Value of the argument passed to method + + + + + Position of the argument in the called method + + + + + The Message to display if check fails + + + + + Type in which the method was called from + + + + + Name of method that was called + + + + + Expected value - set only when is used + + + This property is set when is used. + + + + + + Default message prefix that can be added to the + + + The message is: Call to [namespace.method] Parameter: [number] + + + + + Delegate to implement a custom parameter checker + + + Typemock Isolator validates parameter values, collections and arrays automatically + there are some cases where this is not enough and a custom checker is needed, + to do so create a check delegation and pass it as a parameter + to Args see and + + + For example, if we need to check that an int parameter is larger then 10 + we can write the following code + + public static bool CheckRange(ParameterCheckerEventArgs data) + { + return (int)data.ArgumentValue > 10; + } + + + Public Shared Function CheckRange(ByVal data As ParameterCheckerEventArgs) As Boolean + CheckRange = data.ArgumentValue > 10; + End Function + + We can then use it in out test + + [Test] + public void Test() + { + TestedClass t = new TestedClass(); + // Start mocking TestedClass + Mock mock = MockManager.Mock(typeof(TestedClass)); + // passInt will be called, arguments must agree with MyChecker + mock.ExpectAlways("passInt").Args(new ParameterCheckerEx(CheckRange)); + // This will pass + t.passInt(16); + // This will fail + t.passInt(3); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub Test() + Dim t As TestedClass = new TestedClass + ' Start mocking TestedClass + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + ' passInt will be called, arguments must agree with MyChecker + mock.ExpectAlways("passInt").Args(New ParameterCheckerEx(AddressOf CheckRange)) + // This will pass + t.passInt(16) + // This will fail + t.passInt(3) + MockManager.Verify() + } + + + + See for built in ParameterCheckers + See Check. to pass an object to the delegate + + + + Data of real parameter value that was passed to the mocked method + True for parameter values that are expected + + + + This might become Obsolete, please use ParameterCheckerEx. Delegate to implement a custom parameter checker + + + Typemock Isolator validates parameter values, collections and arrays automatically + there are some cases where this is not enough and a custom checker is needed, + to do so create a check delegation and pass it as a parameter + to Args see and + + + For example, if we need to check that an int parameter is larger then 10 + we can write the following code + + public static bool CheckRange(object parameter) + { + return (int)parameter > 10; + } + + + Public Shared Function CheckRange(ByVal parameter As Object) As Boolean + CheckRange = parameter > 10; + End Function + + We can then use it in out test + + [Test] + public void Test() + { + TestedClass t = new TestedClass(); + // Start mocking TestedClass + Mock mock = MockManager.Mock(typeof(TestedClass)); + // passInt will be called, arguments must agree with MyChecker + mock.ExpectAlways("passInt").Args(new ParameterChecker(CheckRange)); + // This will pass + t.passInt(16); + // This will fail + t.passInt(3); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub Test() + Dim t As TestedClass = new TestedClass + ' Start mocking TestedClass + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + ' passInt will be called, arguments must agree with MyChecker + mock.ExpectAlways("passInt").Args(New ParameterChecker(AddressOf CheckRange)) + // This will pass + t.passInt(16) + // This will fail + t.passInt(3) + MockManager.Verify() + End Sub + + + + See for built in ParameterCheckers + + + + The real parameter value that was passed to the mocked method + True for parameter values that are expected + + + + + + + + + + + + + + + Delegate to implement a custom return value + + + Typemock Isolator allows you to specify mocked return values for mocked methods. + These values are normally hard coded, but + there are some cases where this is not enough and a custom return value is needed, + to do so create a delegation method and pass it as the return value to + one of the setup methods + + + For example, if we need to return the first int parameter of a mocked method, but throw an exception + if the value is 0, we can write the following code + + public static object MyReturnValue(object[] parameters, object context) + { + if ((int)parameters[0]==0) + { + throw new Exception(); + } + return parameters[0]; + } + + + Public Shared Function MyReturnValue(ByVal parameters() As Object, ByVal that As Object) As Object + If parameters(0)=0 Then + Throw New Exception + End If + MyReturnValue = parameters(0) + End Function + + We can then use it in our test + + [Test] + public void Test() + { + // Start mocking TestedClass + Mock mock = MockManager.Mock(typeof(TestedClass)); + // getInt will be called, it will return our dynamic values + mock.AlwaysReturn("getInt",new DynamicReturnValue(MyReturnValue)); + TestedClass t = new TestedClass(); + // This will pass + Assert.AreEqual(10,t.getVar(10)); + // so will this + Assert.AreEqual(1,t.getVar(1)); + // this will throw an exception + t.getVar(0); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub Test() + ' Start mocking TestedClass + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + ' getInt will be called, it will return our dynamic values + mock.AlwaysReturn("getInt",New DynamicReturnValue(AddressOf MyReturnValue)) + Dim t As TestedClass = New TestedClass() + ' This will pass + Assert.AreEqual(10,t.getVar(10)) + ' so will this + Assert.AreEqual(1,t.getVar(1)) + ' this will throw an exception + t.getVar(0) + MockManager.Verify() + End Sub + + + + + BEWARE, Typemock Isolator does not check the legitimacy of the returned value, if you + return a value with the wrong type a System.InvalidCastException will be + thrown + + + BEWARE, All code that is run inside the delegate is NOT mocked. + thrown + + + To continue with the original method without mocking, return + + + You can use DynamicReturnValue to change ref and out parameters + Just change the values of the parameters array and if the parameter is referenced it will change its + value. Again Typemock Isolator does not check the legitimacy of the value. + + + array of parameters passed to mocked method + a reference to the mocked object instance, or null if the method is static + custom return value + If return a value of the wrong type + + + + Event that is fired after a mocked method is called and after validation is performed + + The Mocked Object or null is the method called is static + Event Method + + The following example will setup Typemock Isolator to call SuccessEvent after each call to a mocked + method. + + + // This will be called when a mocked method is called + private void SuccessEvent(object sender,MockMethodCallEventArgs e) + { + Assert.AreEqual(typeof(TestedClass),e.CalledType); + Assert.AreEqual("getVar",e.CalledMethodName); + Assert.AreEqual(0,e.SentArguments.Length); + Assert.AreEqual(0,e.ExpectedArguments.Length); + Assert.AreEqual(false,e.WillThrowException); + Assert.AreEqual(null,e.Exception); + Assert.AreEqual(5,e.ReturnValue); + Assert.AreEqual(true,e.HasPassedValidation); + } + [Test] + public void SimpleEventSuccess() + { + Mock mock = MockManager.Mock(typeof(TestedClass),false); + TestedClass t = new TestedClass(); + + mock.ExpectAndReturn("getVar",5); + // set event listener + mock.MockMethodCalled += new MockMethodCalledEventHandler(SuccessEvent); + // the event will be called + Assert.AreEqual(5,t.getVar()); + mock.Verify(); + } + + + + ' This will be called when a mocked method is called + Public Shared Sub SuccessEvent(ByVal sender As Object, ByVal e As MockMethodCallEventArgs) + Assert.AreEqual(GetType(TestedClass),e.CalledType) + Assert.AreEqual("getVar",e.CalledMethodName) + Assert.AreEqual(0,e.SentArguments.Length) + Assert.AreEqual(0,e.ExpectedArguments.Length) + Assert.AreEqual(False,e.WillThrowException) + Assert.AreEqual(Nothing,e.Exception) + Assert.AreEqual(5,e.ReturnValue) + Assert.AreEqual(True,e.HasPassedValidation) + End Sub + + <Test()> _ + Public Sub SimpleEventSuccess() + Dim t As TestedClass = new TestedClass + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + + mock.ExpectAndReturn("getVar",5) + ' set event listener + AddHandler mock.MockMethodCalled, AddressOf SuccessEvent + ' the event will be called + Assert.AreEqual(5,t.getVar()) + mock.Verify() + End Sub + + + To set an event per method see and Mock. + To set a global event for a mocked type see Mock. + When static methods are called events from ALL mocks of that type are triggered. So if a type is mocked for + two instances, and both have AfterMock Events, both will be triggered after a static member of that type is called. This + is because static methods are not associated with an instance. + + + + + + + + Verify Mode is the way that Typemock Isolator verifies uncalled expected methods + + + + + + + Fail if an expected method is not called + + + + + Pass even if an expected method is not called + + + + + Expectations will not fail if some calls are still expected and expectations are not cleared. + To Clear use or + + + + + Summary description for About. + + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + Summary description for StateFullDelegate. + + + + + This class provides built in Parameter Checkers. See + and + + + Following is an example of using the build in IsNull Check + + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.IsNull(),null); + t.SomeMethod(null,null); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + mock.ExpectCall("SomeMethod").Args(Check.IsNull(),Nothing) + t.SomeMethod(Nothing,Nothing) + MockManager.Verify() + End Sub + + + + + + + + Check that parameter is null, this is equivalent to passing null + + + + Here is an example of how to use IsNull + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.IsNull(),null); + t.SomeMethod(null,null); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + mock.ExpectCall("SomeMethod").Args(Check.IsNull(),Nothing) + t.SomeMethod(Nothing,Nothing) + MockManager.Verify() + End Sub + + + + + IsNull ParameterChecker + + + + Check that parameter is null, with custom error message (see ) + + Custom Error Message + IsNull ParameterChecker + + + + Check that parameter is null, with custom error message and arguments for message (see ) + + Custom Error Message + Arguments for error message + IsNull ParameterChecker + + + + Allow any parameter value (Doesn't check parameter) + + + Here is an example of how to use IsAny + + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.IsAny()); + t.SomeMethod("Anything"); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + mock.ExpectCall("SomeMethod").Args(Check.IsAny()) + t.SomeMethod("Anything") + MockManager.Verify() + End Sub + + + + + IsAny ParameterChecker + + + + Check that parameter is of the passed type + + + Check that parameter is the passed type, extends the passed type, or implements the passed type + + Here is an example of how to use IsTypeOf + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.IsTypeOf(typeof(string))); + t.SomeMethod("Anything"); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + mock.ExpectCall("SomeMethod").Args(Check.IsTypeOf(GetType(String))) + t.SomeMethod("Anything") + MockManager.Verify() + End Sub + + + + + The type that we expect to be passed + IsTypeOf ParameterChecker + + + + Check that parameter is of the passed type, with custom error message and arguments for message (see ) + + The type that we expect to be passed + Custom Error Message + IsTypeOf ParameterChecker + + + + Check that parameter is of the passed type, with custom error message and arguments for message (see ) + + The type that we expect to be passed + Custom Error Message + Arguments for error message + IsTypeOf ParameterChecker + + + + Check that parameter is of the passed type. + + AreSameType ParameterChecker + + This is code sugar and is equivalent to + + + [Test] + public void CheckParameters() + { + Mock mock = Mock<TestedClass>.MockNextInstance(); + mock.ExpectCall("SomeMethod").Args(Check<int>.AreSameType()); + + TestedClass test = new TestedClass(); + test.SomeMethod(5); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock = Mock(Of TestedClass).MockNextInstance() + mock.ExpectCall("SomeMethod").Args(Check(Of Integer)).AreSameType()) + + Dim test As TestedClass = New TestedClass + test.SomeMethod(5) + MockManager.Verify() + End Sub + + + + + + + Check that parameter is of the passed type with custom error message and arguments for message (see ) + + Custom Error Message + Arguments for error message + AreSameType ParameterChecker + + + + Check that parameter is equal to expected value, this is equivalent to calling the expected object Equals method. + + + Single Dimension Arrays and Collections are iterated and checked for match of all items + + Here is an example of how to use IsEqual + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.IsEqual("String"),"Another")); + t.SomeMethod("String","Another"); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + mock.ExpectCall("SomeMethod").Args(Check.IsEqual("String"),"Another"))) + t.SomeMethod("String","Another") + MockManager.Verify() + End Sub + + + + + The value that we expect to be passed + IsEqual ParameterChecker + + + + Check that parameter is equal to expected value, this is equivalent to calling the expected object Equals method, with custom error message (see ) + + The value that we expect to be passed + Custom Error Message + IsEqual ParameterChecker + + + + Check that parameter is equal to expected value, this is equivalent to calling the expected object Equals method, with custom error message and arguments for message (see ) + + The value that we expect to be passed + Custom Error Message + Arguments for error message + IsEqual ParameterChecker + + + + Call Custom Parameter Checker and send the expected value to the delegate + This will set + + + + Here is an example of how to use CustomChecker + + public static bool CheckParameter(ParameterCheckerEventArgs data) + { + return data.ArgumentValue == data.ExpectedValue; + } + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + // setup expectation, test first argument by calling our CheckParameter + // with ExpectedValue set + mock.ExpectCall("SomeMethod").Args(Check.CustomChecker(new ParameterCheckerEx(CheckParameter),"String"))); + t.SomeMethod("String"); + MockManager.Verify(); + } + + + Public Shared Function CheckParameter(ByVal data As ParameterCheckerEventArgs) As Boolean + CheckParameter = data.ArgumentValue = data.ExpectedValue; + End Function + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + ' setup expectation, test first argument by calling our CheckParameter + ' with ExpectedValue set + mock.ExpectCall("SomeMethod").Args(Check.CustomChecker(New ParameterCheckerEx(AddressOf CheckParameter),"String")) + t.SomeMethod("String") + MockManager.Verify() + End Sub + + + + + + The custom parameter checker + The value that we expect to be passed + CustomChecker ParameterCheckerEx + + + + Call Custom Parameter Checker and send the expected value to the delegate, with custom error message (see ) + This will set + + + The custom parameter checker + The value that we expect to be passed + Custom Error Message + IsEqual ParameterChecker + + + + Call Custom Parameter Checker and send the expected value to the delegate, with custom error message and arguments for message (see ) + This will set + + + The custom parameter checker + The value that we expect to be passed + Custom Error Message + Arguments for error message + IsEqual ParameterChecker + + + + Check that parameter is referencing the same object as the expected object. + + + + Here is an example of how to use IsSame + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + object pass = new object(); + mock.ExpectCall("SomeMethod").Args(Check.IsSame(pass),"Another")); + t.SomeMethod(pass,"Another"); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + Dim pass As Object = New Object + mock.ExpectCall("SomeMethod").Args(Check.IsSame(pass),"Another"))) + t.SomeMethod(pass,"Another") + MockManager.Verify() + End Sub + + + + + The object that we expect to be passed + IsSame ParameterChecker + + + + Check that parameter is referencing the same object as the expected object, with custom error message (see ) + + The object that we expect to be passed + Custom Error Message + IsSame ParameterChecker + + + + Check that parameter is referencing the same object as the expected object, with custom error message and arguments for message (see ) + + The object that we expect to be passed + Custom Error Message + Arguments for error message + IsSame ParameterChecker + + + + Check that parameter is equal to one of the items expected + + + + Here is an example of how to use IsIn + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.IsIn("String","Another")); + t.SomeMethod("String"); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + Dim pass As Object = New Object + mock.ExpectCall("SomeMethod").Args(Check.IsIn("String","Another")) + t.SomeMethod("String") + MockManager.Verify() + End Sub + + + + + The values that we expect to be passed + IsIn ParameterChecker + + + + Reverse argument checks + + + + Here is an example of how to use Not + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.Not("Another")); + t.SomeMethod("String"); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + Dim pass As Object = New Object + mock.ExpectCall("SomeMethod").Args(Check.Not("Another")) + t.SomeMethod("String") + MockManager.Verify() + End Sub + + + + + The values/Parameter checkers that we expect not to be passed + Not ParameterChecker + + + + Reverse argument checks, with custom error message (see ) + + The values/Parameter checkers that we expect not to be passed + Custom Error Message + Not ParameterChecker + + + + Reverse argument checks, with custom error message and arguments for message (see ) + + The values/Parameter checkers that we expect not to be passed + Custom Error Message + Arguments for error message + Not ParameterChecker + + + + Check that argument is one of the given values/checks + + + + Here is an example of how to use Or + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.Or("Another",Checks.Equal("String"))); + t.SomeMethod("String"); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + Dim pass As Object = New Object + mock.ExpectCall("SomeMethod").Args(Check.Or("Another"),Checks.Equal("String"))) + t.SomeMethod("String") + MockManager.Verify() + End Sub + + + + + values/Parameter checkers that we expect to be passed + values/Parameter checkers that we expect to be passed + Or ParameterChecker + + + + Check that argument is one of the given values/checks, with custom error message (see ) + + values/Parameter checkers that we expect to be passed + values/Parameter checkers that we expect to be passed + Custom Error Message + Or ParameterChecker + + + + Check that argument is one of the given values/checks, with custom error message and arguments for message (see ) + + values/Parameter checkers that we expect to be passed + values/Parameter checkers that we expect to be passed + Custom Error Message + Arguments for error message + Or ParameterChecker + + + + Check that argument is both of the given values/checks + + + + Here is an example of how to use And + + [Test] + public void CheckParameters() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("SomeMethod").Args(Check.And("String",Checks.IsTypeOf(typeof(String)))); + t.SomeMethod("String"); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim mock As Mock MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + Dim pass As Object = New Object + mock.ExpectCall("SomeMethod").Args(Check.And("String"),Checks.IsTypeOf(GetType(String)))) + t.SomeMethod("String") + MockManager.Verify() + End Sub + + + + + values/Parameter checkers that we expect to be passed + values/Parameter checkers that we expect to be passed + And ParameterChecker + + + + Check that argument is both of the given values/checks, with custom error message (see ) + + values/Parameter checkers that we expect to be passed + values/Parameter checkers that we expect to be passed + Custom Error Message + And ParameterChecker + + + + Check that argument is both of the given values/checks, with custom error message and arguments for message (see ) + + values/Parameter checkers that we expect to be passed + values/Parameter checkers that we expect to be passed + Custom Error Message + Arguments for error message + And ParameterChecker + + + + Check that argument not equal to the given value, this is the same as Not(IsEqual(expected)) + + + Value that we expect not to be passed + NotEqual ParameterChecker + + + + Check that argument not equal to the given value, with custom error message (see ) + + Value that we expect not to be passed + Custom Error Message + NotEqual ParameterChecker + + + + Check that argument not equal to the given value, with custom error message and arguments for message (see ) + + Value that we expect not to be passed + Custom Error Message + Arguments for error message + NotEqual ParameterChecker + + + + Check that argument is not null, this is the same as Not(IsNull()) + + + NotNull ParameterChecker + + + + Check that argument not null, with custom error message (see ) + + Custom Error Message + NotNull ParameterChecker + + + + Check that argument not null, with custom error message and arguments for message (see ) + + Custom Error Message + Arguments for error message + NotNull ParameterChecker + + + + Check that argument is not in the provided list, this is the same as Not(IsIn(expected)) + + + The values that we expect not to be passed + NotNull ParameterChecker + + + + Check that argument is equal to expected string, ignoring case + + + The value that we expect to be passed + IsEqualIgnoreCase ParameterChecker + + + + Check that argument is equal to expected string, ignoring case, with custom error message with (see ) + + The value that we expect to be passed + Custom Error Message + IsEqualIgnoreCase ParameterChecker + + + + Check that argument is equal to expected string, ignoring case, with custom error message and arguments for message (see ) + + The value that we expect to be passed + Custom Error Message + Arguments for error message + IsEqualIgnoreCase ParameterChecker + + + + Check that argument is equal to expected string, ignoring white spaces + + + The value that we expect to be passed + IsEqualIgnoreWhiteSpace ParameterChecker + + + + Check that argument is equal to expected string, ignoring white spaces, with custom error message (see ) + + The value that we expect to be passed + Custom Error Message + IsEqualIgnoreWhiteSpace ParameterChecker + + + + Check that argument is equal to expected string, ignoring white spaces, with custom error message and arguments for message (see ) + + The value that we expect to be passed + Custom Error Message + Arguments for error message + IsEqualIgnoreWhiteSpace ParameterChecker + + + + Check that argument starts with expected string, + + + The start of the value that we expect to be passed + StartsWith ParameterChecker + + + + Check that argument starts with expected string, with custom error message (see ) + + The start of the value that we expect to be passed + Custom Error Message + StartsWith ParameterChecker + + + + Check that argument starts with expected string, with custom error message and arguments for message (see ) + + The start of the value that we expect to be passed + Custom Error Message + Arguments for error message + StartsWith ParameterChecker + + + + Check that argument ends with expected string, + + + The end of the string that we expect to be passed + EndsWith ParameterChecker + + + + Check that argument ends with expected string, with custom error message (see ) + + The end of the string that we expect to be passed + Custom Error Message + EndsWith ParameterChecker + + + + Check that argument ends with expected string, with custom error message and arguments for message (see ) + + The end of the string that we expect to be passed + Custom Error Message + Arguments for error message + EndsWith ParameterChecker + + + + Check that argument matches the expected regular expression, + + + The regular expression the we expect the passed string to match + IsMatch ParameterChecker + + + + Check that argument matches the expected regular expression, with custom error message (see ) + + The regular expression the we expect the passed string to match + Custom Error Message + IsMatch ParameterChecker + + + + Check that argument matches the expected regular expression, with custom error message and arguments for message (see ) + + The regular expression the we expect the passed string to match + Custom Error Message + Arguments for error message + IsMatch ParameterChecker + + + + Check that argument is equal to the expected value with a fault tolerance provided + + The value will be checked to be in between expected +/- tolerance + + The expected value + A tolerance that we will pass + IsCloseTo ParameterChecker + + + + Check that argument is equal to the expected value with a fault tolerance provided, with custom error message (see ) + + The expected value + A tolerance that we will pass + Custom Error Message + IsCloseTo ParameterChecker + + + + Check that argument is equal to the expected value with a fault tolerance provided, with custom error message and arguments for message (see ) + + The expected value + A tolerance that we will pass + Custom Error Message + Arguments for error message + IsCloseTo ParameterChecker + + + + Check that argument is a mocked types that is controlled by mock + + + + Here is an example of how to use And + + [Test] + public void CheckParameters() + { + Mock passedMock = MockManager.Mock(typeof(ArgumentClass)); + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + mock.ExpectCall("PassArgument").Args(Check.IsMock(passedMock)); + t.PassArgument(new ArgumentClass()); + MockManager.Verify(); + } + + + <Test()> _ + Public Sub CheckParameters() + Dim passedMock As Mock = MockManager.Mock(GetType(ArgumentClass)) + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + Dim pass As Object = New Object + mock.ExpectCall("PassArgument").Args(Check.IsMock(passedMock)) + t.PassArgument(new ArgumentClass) + MockManager.Verify() + End Sub + + + + + The mock that the expected parameter is controlling + IsMock ParameterChecker + + + + Check that argument is a mocked types that is controlled by mock + + The mock that the expected parameter is controlling + Custom Error Message + IsCloseTo ParameterChecker + + + + Check that argument is a mocked types that is controlled by mock + + The mock that the expected parameter is controlling + Custom Error Message + Arguments for error message + IsCloseTo ParameterChecker + + + + + + + Summary description for About. + + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + Summary description for AboutMessage. + + + + + All members are neither thread-safe nor process-safe! It's up to you to synchronize access. + + + + Instanciate a new memory mapped array for inter-process access. + + The memory mapped file view. + The count of entries of the array. + The (maximal) count of bytes per entry. + + If true, it accepts other length and bytesPerEntry if the array already exists. + If falls it throws an exception if the array already exists but with other length or bytesPerEntry. + + An optional initial positive offset before the array starts. + + + + + + + Serializes the data and writes it to the file. + + The data to serialize. + + + + Serializes the data and writes it to the file. + + The data to serialize. + The position in the file to start. + + + + Serializes the data and writes it to the file. + + The data to serialize. + The position in the file to start. + The buffer size in bytes. + + + + MockedEvent is used to validate firing of events. + + To use this an event must be mocked first, and then the test can fire that event to test that the correct methods are actually called. + + + + + When more than one instance of the event published is mocked, use the MockedEvent.[index] property + The first instance to register to the event will be in index 0, the next instance in 1 and so on. + + + + Example of one instance of Button having the Click event mocked. We will fire the event to test that our TestedClass + event handler is called + + // Part of tested class + public void Init() + { + Button button = new Button(); + button.Click += new EventHandler(button_Click); + } + + + Public Sub Init() + Dim button As Button = New Button + AddHandler button.Click, AddressOf button_Click + End Sub + + Here is the test + + [Test] + public void Test() + { + // we will mock the Click event and save the MockedEvent + Mock buttonMock = MockManager.Mock(typeof(Button)); + MockedEvent buttonHandle = buttonMock.ExpectAddEvent("Click"); + + // we expect button_Click to be called once (when the button is clicked) + Mock testedMock = MockManager.Mock(typeof(TestedClass)); + testedMock.ExpectCall("button_Click"); + + // call our code + TestedClass test = new TestedClass(); + test.Init(); + + // emulate click. + buttonHandle.Fire(this, EventArgs.Empty); + + // verify that all calls where made + MockManager.Verify(); + } + // Natural Mocks + [Test] + public void Test() + { + MockedEvent buttonHandle; + // Start mocking + using (RecordExpectations recorder = RecorderManager.StartRecording()) + { + // we will mock the Click event and save the MockedEvent + Button buttonMock = new Button(); + buttonMock.Click += null; + buttonHandle = RecorderManager.LastMockedEvent; + + // we expect button_Click to be called once (when the button is clicked) + TestedClass testMock = new TestedClass(); + testMock.button_Click(null,null); // use Reflective Mocks if this is private + } + + // call our code + TestedClass test = new TestedClass(); + test.Init(); + + // emulate click. + buttonHandle.Fire(this, EventArgs.Empty); + + // verify that all calls where made + MockManager.Verify(); + } + + + <Test()> _ + Public Sub Test() + ' we will mock the Click event and save the MockedEvent + Dim buttonMock As Mock = MockManager.Mock(GetType(Button)) + Dim buttonHandle As MockedEvent = buttonMock.ExpectAddEvent("Click") + + ' we expect button_Click to be called once (when the button is clicked) + Dim testedMock As Mock = MockManager.Mock(GetType(TestedClass)) + testedMock.ExpectCall("button_Click") + + ' call our code + Dim test As New TestedClass + test.Init() + + ' emulate click. + buttonHandle.Fire(Me, EventArgs.Empty) + ' Verify that all calls were made + MockManager.Verify() + End Sub + + ' .NET 2.0 Natural Mocks + <Test()> _ + Public Sub Test() + Dim buttonHandle As MockedEvent + Dim test As New TestedClass + Using recorder As New RecordExpectations + ' mock the Click event and save the MockedEvent + Dim buttonMock As Button = New Button() + AddHandler buttonMock.Click, AddressOf test.button_Click + buttonHandle = RecorderManager.LastMockedEvent + + ' we expect button_Click to be called once (when the button is clicked) + testMock.button_Click(Nothing, Nothing) ' use Reflective Mocks if this is private + End Using + + ' call our code + test.Init() + + ' emulate click. + buttonHandle.Fire(Me, EventArgs.Empty) + ' Verify that all calls were made + MockManager.Verify() + End Sub + + For VB .NET 1.1 see + + + Since Version 3.6 + + + + + Used to get return values for NaturalMocks, so that we can do recorder.Repeat + + + + + Fire a mocked event + + Arguments to pass to the mocked event + The return value of the event + + + + Retrieve the EventHandle + + + Using GetEventHandle can help write type-safe tests by casting the EventHandle to the correct Event Type + Example + + EventHandler fire = handle.GetEventHandle() as EventHandler; + fire(this, EventArgs.Empty); + + + Dim fire As EventHandler = handle.GetEventHandle() + fire(Me, EventArgs.Empty) + + + The Event + + + + Retrieve the when more than one instance of the event published is mocked + + The first instance to register to the event will be in index 0, the next instance in 1 and so on. + This is used to simulate firing the event. + + + + + Following is an example of 2 Buttons whose Click event is mocked. The test will fire both Buttons one after + the other. + + [Test] + public void SimulateFiringClickOnManyButtons() + { + // Mock all Click Events of the all Buttons + Mock buttonMock = MockManager.MockAll(typeof(Button)); + MockedEvent handle = buttonMock.ExpectAddEventAlways("Click"); + + // create 2 buttons and register to the Click Event + Button button1 = new Button(); + Button button2 = new Button(); + button1.Click += new EventHandler(button_Click); + button2.Click += new EventHandler(button_Click); + + // Simulate firing Click of button1 + handle.Instance[0].Fire(this, EventArgs.Empty); + // Simulate firing Click of button2 + handle.Instance[1].Fire(this, EventArgs.Empty); + // Check that system works... + + MockManager.Verify() + } + + + <Test()> _ + Public Sub SimulateFiringClickOnManyButtons() + 'Mock all Click Events of the all Buttons + Dim buttonMock As Mock = MockManager.MockAll(GetType(Button)) + Dim handle As MockedEvent = buttonMock.ExpectAddEventAlways("Click") + + ' create 2 buttons and register to the Click Event + Dim button1 As Button = New Button + Dim button2 As Button = New Button + + AddHandler button1.Click, AddressOf button_Click + AddHandler button2.Click, AddressOf button_Click + + ' Simulate firing Click of button1 + handle.Instance(0).Fire(Me, EventArgs.Empty) + ' Simulate firing Click of button2 + handle.Instance(1).Fire(Me, EventArgs.Empty) + ' Check that system works... + + MockManager.Verify() + End Sub + + + Since Version 3.7 + + + + + Return the number of instances registered to this mocked event. See + + + Since version 3.7 + + + + + Holds all the created mocks + + + + + Manage all expectations set on a specific method + + + There are two kinds of call expectations values - Default and sequenced. + The Default is used to Always return the same value, and the sequence + return according to call sequence, there are also two corresponding types for conditional + and default conditional + + + Create a new default call expectation. + Note - this will replace the previous default + + + Add a new regular call expectation + + + + this is the main api used during the test execution, when a method is mocked we will call this + to "activate" the behavior which was dictated during the expectation setup phase. + + the value to return to the user + + + search mechanism is: + 1: Conditional + 1.1: specific calls + 1.2: Default + 2: Regular + 2.1: specific calls + 2.2: Default + if not found any returns null! + + + this search the actual return value according to condition (playback time) + + + + Count the number of unfulfilled expectations. + + number of calls left (Negative can happen with default returns) + + + + this will count the number of calls which were not made. + (only calls with normal verification mode are counted) + + + + + Clear all expectations of a mock (clears static members made by an instance mock) + + if no expectations are left + + + + this return true if we have unfulfiled conditional returns + + + + + Checks if we are in Break Mode according to the Mutex. + If we are, result is true, and we need to release the lock. + + + + + + In Run mode, functions need to be run, thus setting expectations in Typemock Isolator + But in Break mode, we don't want to evaluate functions that will set the expecation, + and this way we can block them. + If we are in Break mode, we know this by acquiring the mutex, and so we need to release it + + + + + Enterprise: perpetual fully featured + Timed: time limited fully featured. Update-timebomed. + Temp: temporary fully featured, used for the period between purchase order and actual purchase. 30 day Usage-timebombed. + Evaluation: fully featured 21 day usage-timebombed + Extended: fully featured 14 day usage-timebombed + + + + + Summary description for Core. + + + + + returns path for system files for 32/64 bit machines + + + + + gets typemock key from registry - 32/64 bit + + + + + + In Isolator: Major version is .NET Version [Major].[Minor] + + + + + + + + + + + Instanciate a new memory mapped array for inter-process access. + + The memory mapped file view. + The count of entries of the array. + The (maximal) count of bytes per entry. + + If true, it accepts other length and bytesPerEntry if the array already exists. + If falls it throws an exception if the array already exists but with other length or bytesPerEntry. + + An optional initial positive offset before the array starts. + All members are neither thread-safe nor process-safe! It's up to you to synchronize access. + + + + Event arguments that are received for the MockMethodCalled. + + + To set an event per method see and Mock. + To set a global event for a mocked type see Mock. + + + + + + + + Type in which the method was called from + + + + + Name of method that was called + + + + + Array of the Argument that where went + + + The arguments are read only, setting these to other values will not change the arguments. + To assign other values see + + + + + Array of the expected arguments sent to the Args method (see ) + + + + + This is true if the mocked method will throw an exception, + Either because the exception was mocked (see or + because of a validation exception. + + + + + This is the exception that will be throw (null unless + is true. + + + + + The mocked return value (null if is true) + + + + + This is true if the method has passed all validations + + + + + This is true if the method is static + + + + + This class will holds all the calls counters for all the types. + FIXME Lior - this class is uses strings in order to match method signatures, need to consider working with real + signatures. + + + + + The counter tables: hash from type,MethodName,methodParams->counter + + + + + default ctor + + + + + retrieve the counter of the given method. + + the name of the class. + the name of the method + if the method is generic needs generic types + the number of times the method got called. 0 if not found + + + + retrieve the number of times the given method has been called. + + the type of the class. + the name of the method + if the method is generic needs generic types + the number of times the method has been called, 0 if method not found. + + + + Increase the counter of the given method + + the name of the class. + the name of the method + if the method is generic needs generic types + + + + clear all stored counters + + + + + + Static methods called by instrumented code, This class delegated to + who holds all the data. It is used to hide the runtime methods from nUnit users + + + + getReturn is overloaded many times to make the instrumented code easier to implement, + if we would have used param object[] we would have to use a local variable and + recalculate the local variable table, this way we just have to find the token for the + correct overloaded method. See CProfilerCallback::JITCompilationStarted + + + + + + Internal use only Get a parameter if changed + + number of parameter + + + Value of changed parameter + + + + Internal use only Reset the ref parameters. Required to be called after each mock + + + + + + + Internal use only Assign parameter + + number of parameter + + + Value of changed parameter + + + + Internal use only + + + + + + true if the current method mocked + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Internal use only Get our return value + + Mocked Return Value + + + + Set locked when inside Typemock Isolator code to disable infinite recurse + + + + + If CONTINUE is returned the mocked method will continue with + normal execution + + + + + Placeholder + + + + + An expectation block (Enterprise Edition Only) + + + + Group a number of expectation. Define an expectation block using Mock. and Mock.. + When grouping expectations in a block you can control + The expectation dynamically. This is very useful when setting up a mock infrastructure. + After defining a block it is possible to: + + Remove the block using Mock.. + + + Add expectations before the block using Mock.. + + + + Blocks can be labeled and can be later on referred to by Mock.. + + Blocks can have different s. + + The following example shows a utility method that sets up expectations + for an AccessController + + private Mock SetupExpectations() + { + //Mock all invocation of AccessController, + Mock mock = MockManager.MockAll(typeof(AccessController)); + + // start a block called loginLabel, this will be verified normally + mock.StartBlock("loginLabel",VerifyMode.Normal); + // We expect that the login method will be called and we will return + // AccessStatus.INVALID_USER the first time and AccessStatus.VALIDATED the + // second time + mock.ExpectAndReturn("Login", AccessStatus.INVALID_USER); + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + mock.EndBlock(); + + // expect another call and return validated. + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + return mock; + } + [Test] + public void TestSomething() + { + Mock mock = SetupExpectations(); + + // In this test we need to add an expectation before our block + mock.StartBlockBefore(mock.GetBlock("loginLabel")); + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED); + mock.EndBlock(); + + // continue with test + } + [Test] + public void TestSomething2() + { + Mock mock = SetupExpectations(); + + // In this test we need to remove the expectation our block + mock.Clear(mock.GetBlock("loginLabel")); + + // continue with test + } + + + Private Function SetupExpectations() As Mock + 'Mock all invocation of AccessController, + Dim mock As Mock = MockManager.Mock(GetType(AccessController)) + + ' start a block called loginLabel, this will be verified normally + mock.StartBlock("loginLabel",VerifyMode.Normal) + ' We expect that the login method will be called and we will return + ' AccessStatus.INVALID_USER the first time and AccessStatus.VALIDATED the + ' second time + mock.ExpectAndReturn("Login", AccessStatus.INVALID_USER) + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + mock.EndBlock() + + ' expect another call and return validated. + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + SetupExpectations = mock + End Function + <Test()> _ + Public Sub TestSomething() + Dim mock As Mock = SetupExpectations() + + ' In this test we need to add an expectation before our block + mock.StartBlockBefore(mock.GetBlock("loginLabel")) + mock.ExpectAndReturn("Login", AccessStatus.VALIDATED) + mock.EndBlock() + + ' continue with test + End Sub + <Test()> _ + Public Sub TestSomething2() + Dim mock As Mock = SetupExpectations() + + ' In this test we need to remove the expectation our block + mock.Clear(mock.GetBlock("loginLabel")) + + ' continue with test + End Sub + + + + + + + + The Expectation Block + + + + first two ids are reserved for firstBlock and lastBlock. + + + + + Return the default expectation block + + + The Name or Label of the Block + + + + + Saves state of object + + + + + Utility Class that takes a snapshot of all the fields of an object or the static fields of a type + , in order to reset all the fields back to the saved state. + + + The ObjectState assists testing classes with hidden field, by resetting these field + when required + + The following example we want to test a class that has a static counter. + + public class StatefulClass + { + static private int count = 0; + public int Count {get { return count++ ;}} + } + + [Test] + public void Stateful() + { + StatefulClass stateful = new StatefulClass(); + // Save our state + ObjectState objState = new ObjectState(state); + // Do something to change the state + Assert.AreEqual(0,stateful.Count); + // lets reset our code for next test + objState.ResetState(); + Assert.AreEqual(0,stateful.Count); + } + + + Public Class StatefulClass + Private Shared count As Integer = 0 + Public ReadOnly Property Count() As Integer + Get + Return _defaultName + End Get + End Property + End Class + + <Test()> _ + Public Sub Stateful() + Dim stateful As StatefulClass = New StatefulClass + ' Save our state + Dim objState As ObjectState = New ObjectState(state) + ' Do something to change the state + Assert.AreEqual(0,stateful.Count) + ' lets reset our code for next test + objState.ResetState() + Assert.AreEqual(0,stateful.Count) + End Sub + + + + + + + Take a snapshot of all the fields of an object, in order to reset + all the fields back to the saved state. + + The object to save the state + + + + Take a snapshot of all the static fields of a type, in order to reset + all the fields back to the saved state. + + The type to save the state + + + + Reset the fields back to their original state + + + + + Sets the value of a non-public field (member variable) of the managed type. + + The name of the non-public field to modify. + value whose type is specific to the field. + + + + Sets the value of a non-public field (member variable) of an instance. + + The instance to modify + The name of the non-public field to modify. + value whose type is specific to the field. + + + + Sets the value of a non-public static field (member variable) of a type. + + The type to modify + The name of the non-public static field to modify. + value whose type is specific to the field. + + + + Gets the value of a non-public field (member variable) of the managed type. + + The name of the non-public field to modify. + value whose type is specific to the field. + + + + Gets the value of a non-public field (member variable) of an instance. + + The instance to read + The name of the non-public field to modify. + value whose type is specific to the field. + + + + Gets the value of a non-public static field (member variable) of a type. + + The type to read + The name of the non-public static field to modify. + value whose type is specific to the field. + + + + CallCounter counts the calls to all registered methods + + + + + + Passing this class as to Args as a Parameter Checker to mock ref and out parameters. Enterprise + Edition users can swap normal argument too. + See + + + Use this class to mock ref and out parameters. Enterprise Edition Users can use the Assign + class to replace arguments of a method at run time. This is useful in conjunction with + Mock. and complex types, where it is easier to change + an argument then to mock all the methods. + + Here is an example of using Assign + + [Test] + public void CheckRefAndOut() + { + Mock mock = MockManager.Mock(typeof(TestedClass)); + TestedClass t = new TestedClass(); + // Check that first arg is "rr" and assign it with "changed" + // Assign the second arg with 3, don't check (same as Check.IsAny()) + mock.ExpectCall("SomeMethod").Args(new Assign("changed").AndCheck("rr"), new Assign(3)); + int a ; + string s = "rr"; + t.SomeMethod(ref s,out a); + Assert.AreEqual(3,a); + Assert.AreEqual("changed",s); + MockManager.Verify(); + } + + + + <Test()> _ + Public Sub CheckRefAndOut() + Dim mock As Mock = MockManager.Mock(GetType(TestedClass)) + Dim t As TestedClass = New TestedClass + ' Check that first arg is "rr" and assign it with "changed" + ' Assign the second arg with 3, don't check (same as Check.IsAny()) + mock.ExpectCall("SomeMethod").Args(New Assign("changed").AndCheck("rr"), New Assign(3)) + Dim a As Integer + Dim s As String = "rr" + t.SomeMethod(s,a) + Assert.AreEqual(3,a) + Assert.AreEqual("changed",s) + MockManager.Verify() + End Sub + + + + Another way to assign ref and out parameter is by using the + Typemock Isolator doesn't check that the parameter is actually passed by ref + Assign will might work correctly for un-mocked expectations. See + Assigning arrays is currently not supported + + + + + Create a new Assign object that will mock ref and out arguments + + + Use in conjunction with + + The value to assign the parameter + + + + Validate the parameter before assigning it a value. + + Expected value or parameter checker + The parameter assigner + + + diff --git a/LinqToUmbraco/dep/Reference Assemblies/Mocking/TypeMock.dll b/LinqToUmbraco/dep/Reference Assemblies/Mocking/TypeMock.dll new file mode 100644 index 0000000000..66602117f0 Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Mocking/TypeMock.dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Mocking/Typemock.ArrangeActAssert.Dll b/LinqToUmbraco/dep/Reference Assemblies/Mocking/Typemock.ArrangeActAssert.Dll new file mode 100644 index 0000000000..eb514c1abb Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Mocking/Typemock.ArrangeActAssert.Dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Mocking/Typemock.ArrangeActAssert.Xml b/LinqToUmbraco/dep/Reference Assemblies/Mocking/Typemock.ArrangeActAssert.Xml new file mode 100644 index 0000000000..542ead3051 --- /dev/null +++ b/LinqToUmbraco/dep/Reference Assemblies/Mocking/Typemock.ArrangeActAssert.Xml @@ -0,0 +1,3571 @@ + + + + Typemock.ArrangeActAssert + + + + + Returned by Isolate.NonPublic., and + Isolate.NonPublic.WhenCalled().. this interface + contains methods for defining behavior for non public methods, as will as a modifier for applying behavior for + generic methods + + + + + Interface for specifying behavior for a void returning intercepted calls. The interface is returned by method. + + + This interface allow tweaking the behavior of methods which return void. + + + + + Interface for specifying behavior for a method call. The interface is extended by and . + + + This interface allow tweaking the behavior of any method by calling its original implementation or throwing an exception from it. + + + + + For internal use only. + + + + + Specify that an intercepted call will try to execute the real logic of the intercepted instance. + + + This interface is returned by method. + + Before using this directive make sure that the intercepted method has a real implementation that can be executed. + + + + This test shows faking an object to return null values, and overriding one of its methods to call its original + implementation: + + [TestMethod] + [Isolated] + public void CallOriginalOnFakeInstance() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnNulls); + + // Override the Increment() method to call its original implementation + Isolate.WhenCalled(() => fake.Increment()).CallOriginal(); + + // Make sure Count is reset + fake.Count = 0; + + // This call now redirects to its original implementation - the count should increment + fake.Increment(); + Assert.AreEqual(1, fake.Count); + + // even though we called the original implementation, we can still verify the call happened + Isolate.Verify.WasCalledWithAnyArguments(() => fake.Increment()); + } + + + + + + Specify that an intercepted call will throw the given exception. + + + This interface is returned by method. + + The exception to throw + + This test shows faking an object, and overriding one of its methods to throw an exception: + + [TestMethod] + [Isolated] + [ExpectedException(typeof(OutOfMemoryException))] + public void WillThrowOnFakeInstance() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Override the Write() method to throw an exception + Isolate.WhenCalled(() => fake.Write("")).WillThrow(new OutOfMemoryException()); + + // This call will now throw an exception when called - this is verified by the + // [ExpectedException] decorator + fake.Write("Hello"); + } + + + + + + Specify that an intercepted call should be ignored without executing any logic. + + + This interface is returned by method. + + + This example shows using IgnoreCall() to stub out a call to a method: + + [TestMethod] + [Isolated] + public void FakeAnInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Increment call will be ignored (stubbed) + Isolate.WhenCalled(() => fake.Increment()).IgnoreCall(); + + // Make sure Count is reset + fake.Count = 0; + + // This call is faked - count should not increment + fake.Increment(); + + Assert.AreEqual(0, fake.Count); + } + + + + + + Run a custom action instead of the methods in the WhecnCalled block. + + The action that will run instead of the faked method + + This example shows using DoInstead() to run custom code instead of a function: + + [TestMethod] + [Isolated] + public void FakeAnInstance_DoInstead() + { + var fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + // Use DoInstead to replace the called method with custom action + Isolate.WhenCalled(() => fake.CallWithArguments("", 0, 0.0)) + .DoInstead((callContext) => + { + // Change the value of a field in the object that called the method + ((RealLogger)callContext.Instance).count = (int)callContext.Parameters[1]; + }); + + // Call the method + fake.CallWithArguments(100); + + // Verify the field's value + Assert.AreEqual(100, fake.count); + } + + + + + + Interface for specifying behavior for intercepted calls on methods returning values. + The interface is returned by . + + + This interface allow tweaking the behavior of methods that has return values. + + + + + Specify that the intercepted method will return the given value. + The real implementation will not be executed. + + The fake value to return when the call is intercepted + + This example shows using WillReturn() to change the return value for a property call: + + [TestMethod] + [Isolated] + public void FakeAnInstance_ChangeMethodReturnValue() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Change the return value for Count property + Isolate.WhenCalled(() => fake.Count).WillReturn(10); + + // fake.Count will return the assigned value + Assert.AreEqual(10, fake.Count); + } + + + + + + Run a custom dunction instead of the methods in the WhecnCalled block. + + The function that will run instead of the faked method + + This example shows using DoInstead() to run custom code instead of a function: + + [TestMethod] + [Isolated] + public void FakeAnInstance_DoInstead() + { + var fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + // Use DoInstead to replace the method called with custom function + Isolate.WhenCalled(() => fake.IntCallWithArgs(0)) + .DoInstead((callContext) => + { + // We can set field on the instance that called the method + ((RealLogger)callContext.Instance).count = (int)callContext.Parameters[0]; + + // Change the returned value + return 100; + }); + + int value = fake.IntCallWithArgs(10); + + // Verify + Assert.AreEqual(100, value); + Assert.AreEqual(10, fake.count); + + + + + + This is the entry point to all AAA APIs. + Use it to fake, swap, set method behavior and verify calls. + The Isolate APIs use fluent interfaces, thus + + + + + Accepts a method in the form of a Lambda expression, to set a specific behavior on it. + + An Action in a form of a Lambda expression (with no parameters) that expresses the method we want to set a behavior on. + A interface reference. + + Because of the nature of fluent interface, WhenCalled should be used with its proceeding methods. + + Here is an example how to use WhenCalled in order to ignore (stub) a call: + + [TestMethod] + [Isolated] + public void FakeAnInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Increment call will be ignored (stubbed) + Isolate.WhenCalled(() => fake.Increment()).IgnoreCall(); + + // Make sure Count is reset + fake.Count = 0; + + // This call is faked - count should not increment + fake.Increment(); + + Assert.AreEqual(0, fake.Count); + } + + + + + + + Accepts a method in the form of a Lambda expression, to set a specific behavior on it. + + + A function in the form of a Lambda Expression (with no parameters) that expresses the method we want to set a behavior on. + A interface reference. + + Because of the nature of fluent interface, WhenCalled should be used with its proceeding methods. + + Here is an example how to use WhenCalled in order to return a value: + + [TestMethod] + [Isolated] + public void FakeAnInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Change the return value of IntCall() + Isolate.WhenCalled(() => fake.IntCall()).WillReturn(10); + + Assert.AreEqual(10, fake.IntCall()); + } + + + + + + + CleanUp should be called at the end of a test. It can be substituted with the . + + + Here is an example how to use CleanUp. The following test uses CleanUp: + + [TestMethod] + public void FakeAnInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Increment call will be ignored (stubbed) + Isolate.WhenCalled(() => fake.IntCall()).WillReturn(10); + + Assert.AreEqual(10, fake.IntCall()); + Isolate.CleanUp(); + } + + + The following test uses IsolatedAttribute and similar in functionality: + + [TestMethod] + [Isolated] + public void FakeAnInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Increment call will be ignored (stubbed) + Isolate.WhenCalled(() => fake.IntCall()).WillReturn(10); + + Assert.AreEqual(10, fake.IntCall()); + } + + + + + + This is the entry point to all AAA APIs. + Use it to fake, swap, set method behavior and verify calls. + The Isolate APIs use fluent interfaces, thus + + + + + A read-only property, used to swap objects and behaviors + + + An interface reference. + + + Because of the nature of fluent interface, you need to use Swap with one of its proceeding methods - + see for details. + + + This example shows how to use Isolate.Swap.. in order to fake a future instance: + + [TestMethod] + [Isolated] + public void SwapAFutureInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + Isolate.Swap.NextInstance<RealLogger>().With(fake); + + Isolate.WhenCalled(() => fake.Increment()).IgnoreCall(); + + // This object is swapped with the fake + RealLogger logger = new RealLogger(); + + // Make sure Count is reset + logger.Count = 0; + + // This call is faked - count should not increment + logger.Increment(); + + Assert.AreEqual(0, logger.Count); + } + + This example shows how to use Isolate.Swap.. in order to + redirect calls from an object to a stand-in object: + + [TestMethod] + [Isolated] + public void SwapCallsOnObject_CallsRedirectedToTargetObject() + { + // Create the object under test + RealLogger logger = new RealLogger(); + // Create the object calls will be redirected to + TestLogger swapped = new TestLogger(); + + // Redirect any calls from the object under test to the swapping target + Isolate.Swap.CallsOn(logger).WithCallsTo(swapped); + + // logger.Write() is redirected to TestLogger.Write() which writes to console instead of disk + logger.Write("Hello World"); + + // We can still verify the call to logger.Write() happened + Isolate.Verify.WasCalledWithAnyArguments(() => logger.Write("")); + } + + // excerpt code for the class under test: + public class RealLogger + { + string logFilePath = ...; + public void Write(string toWrite) + { + logFile.WriteAllText(logFilePath, toWrite); + } + } + + // excerpt code for the replacement class: + public class TestLogger + { + public void Write(string toWrite) + { + Console.WriteLine("RealLogger.Write() was called with {0}", toWrite); + } + } + + + + + + A read-only property, used to fake a new object. + + + An interface reference. + + + Because of the nature of fluent interface, you need to use Fake with its proceeding methods - + see for details. + + + This example shows how to use Fake in order to fake a RealLogger instance: + + [TestMethod] + [Isolated] + public void FakeAnInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Increment call will be ignored (stubbed) + Isolate.WhenCalled(() => fake.Increment()).IgnoreCall(); + + // Make sure Count is reset + fake.Count = 0; + + // This call is faked - count should not increment + fake.Increment(); + + Assert.AreEqual(0, fake.Count); + } + + + + + + + A read-only property, used to fake non public members + + + An IIsolateNonPublic reference + + + Because of the nature of fluent interface, you need to use NonPublic with one of its proceeding methods, see + + When handling non public (private, protected, internal) class members all access to method names is string-based. + + + + This example shows how to use NonPublic in order to set behavior on a private method: + + [TestMethod] + [Isolated] + public void StubPrivateMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Avoid performing actual write to disk by ignoring (stubbing) a private call + Isolate.NonPublic.WhenCalled(fake, "WriteToDisk").IgnoreCall(); + + // This call is faked - count should not increment + fake.Log("Hello World"); + + Assert.AreEqual(1, fake.LineCount); + // Verify the private call was actually made + Isolate.Verify.NonPublic.WasCalled(fake, "WriteToDisk").WithArguments("Hello World"); + } + + + + + + Return a verifying object that can verify calls were made or not, and check if their arguments were sent correctly. + + An ICallVerifier interface reference. + + Because of the nature of fluent interface, you need to use Verify with one of its proceeding methods: + , , + and + + + This example shows how to use Verify in order to check a method was called: + + [TestMethod] + [Isolated] + public void VerifyStubWasCalled_FailWhenNotCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Increment(); + + Isolate.Verify.WasCalledWithAnyArguments(() => fake.Increment()); + } + + + + + + Returned by Isolate.Verify., this interface contains methods for verifying non + public (private, protected and internal) method, property and index calls, and checking argumentrs. + + + + + Overloaded. Verifies that a non-public method has been called + + The fake object to verify method behavior on + The method to verify behavior for + An interface reference, used to add argument checking + + In order to perform additional argument checking as part of the verification, use the proceeding + method. + + + Thrown if the method was not called. + + + This example shows how to use Isolate.Verify.NonPublic in order to check a method was called: + + [TestMethod] + [Isolated] + public void VerifyMethodWasCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Write("Hello"); + + // Verify the internal call to WriteToDisk() was performed with correct arguments + Isolate.Verify.NonPublic.WasCalled(fake, "WriteToDisk").WithArguments("Hello"); + } + + + + + + + Overloaded. Verifies that a non-public static method has been called + + The type to verify static method behavior on + The method to verify behavior for + An interface reference, used to add argument checking + + In order to perform additional argument checking as part of the verification, use the proceeding + method. + + + Thrown if the method was not called. + + + This example shows how to use Isolate.Verify.NonPublic in order to check a static method was called: + + [TestMethod] + [Isolated] + public void VerifyStaticMethodWasCalled() + { + Isolate.Fake.Instance<LoggerFactory>(Members.CallOriginal); + + RealLogger logger = LoggerFactory.GetLogger("logfile.txt", Access.ReadWrite); + + // Verify the call to internal method LoggerFactory.GetRealLogger() has been made + Isolate.Verify.NonPublic.WasNotCalled(typeof(LoggerFactory), "GetRealLogger"). + WithArguments("logfile.txt", Access.ReadWrite); + } + + + + + + + Overloaded. Verifies that a non-public method was not called regardless of parameters. + + The fake object to verify method behavior on + The method to verify behavior for + + Thrown if the method was called at least once. + + + This example shows how to use Isolate.Verify.NonPublic in order to check a method was not called + + [TestMethod] + [Isolated] + public void VerifyMethodWasNotCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Write("Hello world!"); + + // The logger write was called, so an internal WriteToDisk() was performed - + // this verification should fail + Isolate.Verify.NonPublic.WasNotCalled(fake, "WriteToDisk"); + } + + + + + + Overloaded. Verifies that a non-public static method was not called regardless of parameters. + + The type to verify static method behavior on + The method to verify behavior for + + Thrown if the method was called at least once. + + + This example shows how to use Isolate.Verify.NonPublic in order to check a method was not called + + [TestMethod] + [Isolated] + public void VerifyMethodWasNotCalled() + { + Isolate.Fake.Instance<LoggerFactory>(Members.CallOriginal); + + RealLogger logger = LoggerFactory.GetLogger(); + + // We retrieved a RealLogger and an internal call to GetRealLogger() was made - + // this verification should fail + Isolate.Verify.NonPublic.WasNotCalled(typeof(LoggerFactory), "GetRealLogger"); + } + + + + + + A read only property, used to verify calls on non-public properties + + + An reference + + + Because of the nature of fluent interface, you need to use Property with one of its proceeding methods, see . + + When handling non public (private, protected, internal) properties all access to property names is string-based. + + + + This example shows how to use Isolate.NonPublic.Property in order to verify the behavior of a private property getter: + + [TestMethod] + [Isolated] + public void VerifyPropertyWasCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Log("Hello World"); + + // Verify an internal disk space check was performed + Isolate.Verify.NonPublic.Property.WasCalledGet(fake, "IsDiskFull"); + } + + + + + + + A read only property, used to verify calls on non-public indexers + + + An reference + + + Because of the nature of fluent interface, you need to use Indexer with one of its proceeding methods, see . + + + This example shows how to use Isolate.NonPublic.Indexer in order to verify behavior on a private index setter: + + [TestMethod] + [Isolated] + public void VerifyIndexSetterWasCalled() + { + LogFile fake = Isolate.Fake.Instance<LogFile>(Members.CallOriginal); + + fake.Write("Hello"); + + // Verify a set call to the LogFile's internal indexer was made + Isolate.Verify.NonPublic.Indexer.WasSetCalled(fake); + } + + + + + + + Returned by Isolate.NonPublic., this interface contains methods for faking and setting + behavior for non-public (private, protected and internal) property get and set calls + + + + + Sets specific behavior for a non-public property getter on an object + + The object to set property behavior for. + The name of a property to set behavior on. + An interface reference. + + Because of the nature of fluent interface, Property.WhenGetCalled should be used with its proceeding methods. + See . + + Here is an example how to use Property.WhenGetCalled in order to set return value on a private property: + + [TestMethod] + [Isolated] + [ExpectedExcetion(typeof(OutOfDiskSpaceException))] + public void ChangePrivatePropertyReturnValue_SimulateDiskError() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Set the behavior on the internal IsDiskFull property to true + Isolate.NonPublic.Property.WhenGetCalled(fake, "IsDiskFull").WillReturn(true); + + // The fake object checks the disk is full before logging and throws an exception + fake.Log("Hello World"); + } + + // Excerpt from class under test + public class RealLogger : ILogger + { + private string fileName; + // method under test + public override void Log(string message) + { + if(IsDiskFull) + { + throw new OutOfDiskSpaceException(); + } + + AppendToFile(fileName, message); + } + + private bool IsDiskFull + { + get { return ...; } + } + } + + + + + + + + Sets specific behavior for a non-public static property getter for a class type + + The type to set static property getter behavior on. Applies to static methods. + The name of a property to set behavior on. + An interface reference. + + Because of the nature of fluent interface, Property.WhenGetCalled should be used with its proceeding methods. + See . + + Here is an example how to use Property.WhenGetCalled in order to set return value on a private property: + + [TestMethod] + [Isolated] + [ExpectedException(typeof(OutOfDiskSpaceException))] + public void ChangePrivatePropertyReturnValue_SimulateDiskError() + { + Isolate.Fake.StaticMethods<RealLogger>(); + + // Set the behavior on the internal IsDiskFull property to true + Isolate.NonPublic.Property.WhenGetCalled(typeof(RealLogger), "IsDiskFull").WillReturn(true); + + RealLogger logger = new RealLogger(); + + // The logger object calls the static property to find out if the disk is full before logging and throws an exception + logger.Log("Hello World"); + } + + // Excerpt from class under test + public class RealLogger : ILogger + { + private string fileName; + // method under test + public static override void Log(string message) + { + if(IsDiskFull) + { + throw new OutOfDiskSpaceException(); + } + + AppendToFile(fileName, message); + } + + private static bool IsDiskFull + { + get { return ...; } + } + } + + + + + + + + Sets specific behavior for a non-public property setter on an object + + The object to set property behavior for. + The name of a property to set behavior on. + An interface reference. + + Because of the nature of fluent interface, Property.WhenSetCalled should be used with its proceeding methods. + See . + + Here is an example how to use Property.WhenSetCalled in order to simulate an error by throwing an exception + on an internal property setter call: + + [TestMethod] + [Isolated] + [ExpectedException(typeof(OutOfDiskSpaceException))] + public void ThrowExceptionFromPrivatePropertySetter_SimulateDiskError() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Set the behavior of the internal CurrentLine property to throw an exception when set + Isolate.NonPublic.Property.WhenSetCalled(fake, "CurrentLine").WillThrow(new OutOfDiskSpaceException()); + + // The object under test tries to log to its internal container and fails because of the exception we set + fake.Log("Hello World"); + } + + // Excerpt from classes under test + public class RealLogger : ILogger + { + private string fileName; + // method under test + public static override void Log(string message) + { + if(IsDiskFull) + { + throw new OutOfDiskSpaceException(); + } + + CurrentLine = message; + } + + private static bool IsDiskFull + { + get { return ...; } + } + + internal string CurrentLine + { + get { return current; } + set { WriteToLogFile(value); current = value; } + } + } + + + + + + + + Sets specific behavior for a non-public static property setter for a class + + The type to set static property setter behavior on. Applies to static methods. + The name of a property to set behavior on. + An interface reference. + + Because of the nature of fluent interface, Property.WhenSetCalled should be used with its proceeding methods. + See . + + Here is an example how to use Property.WhenSetCalled in order to simulate an error by throwing an exception + on an internal property setter call: + + [TestMethod] + [Isolated] + [ExpectedException(typeof(OutOfMemoryException))] + public void ThrowExceptionFromPrivatePropertySetter_SimulateMemoryFull() + { + Isolate.Fake.Instance<LogContainer>(); + + // Set the behavior on the internal IsDiskFull property to true + Isolate.NonPublic.Property.WhenSetCalled(typeof(LogContainer), "Cache").WillThrow(new OutOfMemoryException()); + + // The object under test tries to log using the LogContainer.Cache internal container and fails because of the exception we set + fake.Log("Hello World"); + } + + // Excerpt from class under test: + public class LogContainer + { + public void Log(string message) + { + LogContainer.Cache.Add(message); + WriteToDisk(message); + } + } + + + + + + + + Interface used for swapping between object method calls and collection values. + + + This interface is returned by the Isolate. property. + + + + + Return a swapping object, in order to swap a future instance of type T with an existing fake object. + + An IFutureSwapper interface refernce. + + Because of the nature of fluent interface, you need to use NextInstance with its proceeding method + + + This example shows using NextInstance in order to fake a future instance: + + [TestMethod] + [Isolated] + public void SwapAFutureInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + Isolate.Swap.NextInstance<RealLogger>().With(fake); + + Isolate.WhenCalled(() => fake.Increment()).IgnoreCall(); + + // This object is swapped with the fake + RealLogger logger = new RealLogger(); + + // Make sure Count is reset + logger.Count = 0; + + // This call is faked - count should not increment + logger.Increment(); + + Assert.AreEqual(0, logger.Count); + } + + + Type of instance to swap. + + + + Enables swapping one object's implementation with another. Followed by the completing statement + . + + The object to swap implementation for + An interface reference. + + When a method is called on the swapped object, it is replaced with a corresponding implementation (a method + with the same signature) on the swapping object. This means that the swapped object will start behaving like + the object it was swapped with for all methods they have in common. + + + This example shows how to use Isolate.Swap.. + in order to redirect calls from an object to a stand-in object: + + [TestMethod] + [Isolated] + public void SwapCallsOnObject_CallsRedirectedToTargetObject() + { + // Create the object under test + RealLogger logger = new RealLogger(); + // Create the object calls will be redirected to + TestLogger swapped = new TestLogger(); + + // Redirect any calls from the object under test to the swapping target + Isolate.Swap.CallsOn(logger).WithCallsTo(swapped); + + // logger.Write() is redirected to TestLogger.Write() which writes to console instead of disk + logger.Write("Hello World"); + + // We can still verify the call to logger.Write() happened + Isolate.Verify.WasCalledWithAnyArguments(() => logger.Write("")); + } + + // excerpt code for the class under test: + public class RealLogger + { + string logFilePath = ...; + public void Write(string toWrite) + { + logFile.WriteAllText(logFilePath, toWrite); + } + } + + // excerpt code for the replacement class: + public class TestLogger + { + public void Write(string toWrite) + { + Console.WriteLine("RealLogger.Write() was called with {0}", toWrite); + } + } + + + + + + + Returned by Isolate.Verify.NonPublic., this interface contains methods for verifying non + public (private, protected and internal) properties + + + + + Overloaded. Verifies that a non-public property getter has been called + + The fake object to verify property behavior on + The non-public property to verify behavior for + + Thrown if the property get was not called. + + + This example shows how to use Isolate.Verify.NonPublic.Property in order to check a private property + get has been called: + + [TestMethod] + [Isolated] + public void VerifyPropertyWasCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Write("Hello"); + + // Verify the private property IsDiskFull has been called + Isolate.Verify.NonPublic.Property.WasCalledGet(fake, "IsDiskFull"); + } + + // Exceprt from class under test + public class RealLogger : ILogger + { + private string fileName; + public void override Write(string message) + { + if(IsDiskFull) + { + throw new OutOfDiskSpaceException(); + } + + WriteToFile(fileName, message); + } + + private bool IsDiskFull + { + get { return ...; } + } + } + + + + + + Overloaded. Verifies that a non-public static property getter has been called + + The type to verify static property get behavior on + The non-public property to verify behavior for + + Thrown if the property get was not called. + + + This example shows how to use Isolate.Verify.NonPublic in order to check a private property + get has been called: + + [TestMethod] + [Isolated] + public void VerifyPropertyWasCalled() + { + Isolate.Fake.Instance<LoggerFactory>(Members.CallOriginal); + + RealLogger logger = LoggerFactory.GetLogger(); + + // Verify the private property DoesLoggerExist has been called + Isolate.Verify.NonPublic.Property.WasCalledGet(typeof(LoggerFactory), "DoesLoggerExist"); + } + + // Excerpt from class under test + public class LoggerFactory + { + private ILogger logger; + public ILogger GetLogger() + { + if(!DoesLoggerExist) + { + logger = new RealLogger(); + } + + return logger; + } + + private bool DoesLoggerExist + { + get { return logger != null; } + } + } + + + + + + Overloaded. Verifies that a non-public property setter has been called with a specific value + + The fake object to verify property behavior on + The non-public property to verify behavior for + + Thrown if the property set was not called or if it was called with a mismatching value. + + + In order to specify the argument to verify use the proceeding method . + + + This example shows how to use Isolate.Verify.NonPublic in order to check a private property + set has been called with a specific value: + + [TestMethod] + [Isolated] + public void VerifyPropertyWasCalled_WithSpecificArgument() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Write("Hello"); + + // Verify the private property LineCount has been set to 1 + Isolate.Verify.NonPublic.Property.WasCalledSetWithExactArgument(fake, "LineCount").WithArgument(1); + } + + // Excerpt from class under test + public class RealLogger : ILogger + { + public void override Write(string message) + { + LineCount = lineCount + 1; + WriteToDisk(lineCount, message); + } + + private int lineCount; + internal int LineCount + { get; set; } + } + + + + + + Overloaded. Verifies that a non-public static property setter has been called with a specific value + + The type to verify static property get behavior on + The non-public property to verify behavior for + + Thrown if the property set was not called or if it was called with a mismatching value. + + + In order to specify the argument to verify use the proceeding method . + + + This example shows how to use Isolate.Verify.NonPublic in order to check a private static property + set has been called with a specific value: + + [TestMethod] + [Isolated] + public void VerifyPropertyWasCalled_WithSpecificArgument() + { + Isolate.Fake.Instance<LoggerFactory>(Members.CallOriginal); + + RealLogger logger = LoggerFactory.GetLogger(); + + // Verify the private property LoggerCount has been set to 1 + Isolate.Verify.NonPublic.Property.WasCalledSetWithExactArgument(typeof(LoggerFactory), "LoggerCount").WithArgument(1); + } + + // Excerpt from class under test + public class LoggerFactory + { + public ILogger GetLogger() + { + LoggerCount++; + return ...; + } + + private static int loggerCount = 0; + protected static int LoggerCount + { get; set; } + } + + + + + + Overloaded. Verifies that a non-public property get was not called regardless of parameters. + + The fake object to verify property behavior on + The property to verify behavior for + + Thrown if the property getter was called at least once. + + + This example shows how to use Isolate.Verify.NonPublic.Property in order to check a property get was not called + + [TestMethod] + [Isolated] + public void VerifyPropertyWasNotCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Write("Hello world!"); + + // The logger write was called, so an internal call to the IsDiskFull property was performed - + // this verification should fail + Isolate.Verify.NonPublic.Property.WasNotCalledGet(fake, "IsDiskFull"); + } + + + // Exceprt from class under test + public class RealLogger : ILogger + { + private string fileName; + public void override Write(string message) + { + if(IsDiskFull) + { + throw new OutOfDiskSpaceException(); + } + + WriteToFile(fileName, message); + } + + private bool IsDiskFull + { + get { return ...; } + } + } + + + + + + Overloaded. Verifies that a non-public static property get was not called regardless of parameters. + + The type to verify static property behavior on + The property to verify behavior for + + Thrown if the property getter was called at least once. + + + This example shows how to use Isolate.Verify.NonPublic.Property in order to check a property get was not called + + [TestMethod] + [Isolated] + public void VerifyPropertyWasNotCalled() + { + Isolate.Fake.Instance<LoggerFactory>(Members.CallOriginal); + + RealLogger logger = LoggerFactory.GetLogger(); + + // We retrieved a RealLogger and an internal call to LoggerFactory.LoggerInstance was made - + // this verification should fail + Isolate.Verify.NonPublic.Property.WasNotCalledGet(typeof(LoggerFactory), "LoggerInstance"); + } + + // Excerpt from class under test + public class LoggerFactory + { + public ILogger GetLogger() + { + if(LoggerInstance == null) + { + LoggerInstance = new ...; + } + return LoggerInstance; + } + + protected ILogger LoggerInstance + { + get { ... } + set { ... } + } + } + + + + + + Overloaded. Verifies that a non-public property set was not called regardless of parameters. + + The fake object to verify property behavior on + The property to verify behavior for + + Thrown if the property setter was called at least once. + + + This example shows how to use Isolate.Verify.NonPublic.Property in order to check a property set was not called + + [TestMethod] + [Isolated] + public void VerifyPropertyWasNotCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Write("Hello world!"); + + // The logger write was called, so internal property LineCount was updated - + // this verification should fail + Isolate.Verify.NonPublic.Property.WasNotCalledSet(fake, "LineCount"); + } + + // Excerpt from class under test + public class RealLogger : ILogger + { + public void override Write(string message) + { + LineCount = lineCount + 1; + WriteToDisk(lineCount, message); + } + + private int lineCount; + internal int LineCount + { get; set; } + } + + + + + + Overloaded. Verifies that a non-public static property set was not called regardless of parameters. + + The type to verify static property behavior on + The property to verify behavior for + + Thrown if the property setter was called at least once. + + + This example shows how to use Isolate.Verify.NonPublic.Property in order to check a property set was not called + + [TestMethod] + [Isolated] + public void VerifyPropertyWasNotCalled() + { + Isolate.Fake.Instance<LoggerFactory>(Members.CallOriginal); + + RealLogger logger = LoggerFactory.GetLogger(); + + // We created a RealLogger and an internal property LoggerFactory.LoggerCount was updated - + // this verification should fail + Isolate.Verify.NonPublic.Property.WasNotCalledSet(typeof(LoggerFactory), "LoggerCount"); + } + + // Excerpt from class under test + public class LoggerFactory + { + public ILogger GetLogger() + { + LoggerCount++; + return ...; + } + + private static int loggerCount = 0; + protected static int LoggerCount + { get; set; } + } + + + + + + Returned by Isolate.Verify., this interface is used to verify + the call was made with specific arguments + + + + + Verify the call was made with the specified arguments + + Mandatory. The first argument to verify. + Optional. Additional arguments to verify. + + + This method is used to complement verifying calls, using + Isolate.Verify.NonPublic., with specific argument verification. + + + All expected call arguments must be passed to this method in order for verification to be performed. + + + Thrown if the call was made with mismatching arguments + + This example shows how to use Isolate.Verify.NonPublic in order to check a method was called with specific arguments: + + [TestMethod] + [Isolated] + public void VerifyMethodWasCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Write("Hello"); + + // Verify the internal call to WriteToDisk() was performed with correct arguments + Isolate.Verify.NonPublic.WasCalled(fake, "WriteToDisk").WithArguments("Hello"); + } + + // Excerpt from class under test + public class RealLogger : ILogger + { + public void override Write(string message) + { + WriteToDisk(message); + } + + private void WriteToDisk(string content) + { ... } + } + + + + + + Returned by Isolate.Verify.Property. and + Isolate.Verify., this interface is used to verify + a property setter call was made with the correct argument + + + + + Verify the property set call was made with the specified argument + + The property set value to verify. + + This method is used to complement verifying property set, using + Isolate.Verify.NonPublic.Property., + with specific argument verification. + + Thrown if the property set call was made with a mismatching argument + + This example shows how to use Isolate.Verify.NonPublic in order to check a private property + set has been called with a specific value: + + [TestMethod] + [Isolated] + public void VerifyPropertyWasCalled_WithSpecificArgument() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Write("Hello"); + + // Verify the private property LineCount has been set to 1 + Isolate.Verify.NonPublic.Property.WasCalledSetWithExactArgument(fake, "LineCount").WithArgument(1); + } + + // Excerpt from class under test + public class RealLogger : ILogger + { + public override void Write(string message) + { + LineCount++; + WriteToDisk...; + } + + private int lineCount; + internal int LineCount + { get; set; } + + } + + + + + + Returned by Isolate.Verify., this interface contains methods for verifying non + public (private, protected and internal) index calls. + + + + + Verify a call has been made to a non-private index getter + + + An reference + + The fake object to verify index behavior on + + In order to verify the index getter has been called at a specific index location, use the proceeding method + . + + + This example shows how to use Isolate.NonPublic.Indexer.WasCalledGet() in order to verify behavior on a private index setter: + + [TestMethod] + [Isolated] + public void VerifyIndexGetterWasCalled() + { + LogFile fake = Isolate.Fake.Instance<LogFile>(Members.CallOriginal); + + string line = fake.GetLineAt(10); + + // Verify a get call to the LogFile's internal indexer was made + Isolate.Verify.NonPublic.Indexer.WasGetCalled(fake).WithIndex(10); + } + + // Excerpt from class under test + public class LogFile + { + public string GetLineAt(int lineNumber) + { + return this[lineNumber]; + } + + protected string this[int line] + { + get { return ...; } + } + } + + + + + + + Verify a call has been made to a non-private index setter + + + An reference + + The fake object to verify index behavior on + + In order to verify the index getter has been called at a specific index location and value, use the proceeding method + . + + + This example shows how to use Isolate.NonPublic.Indexer.WasCalledSet() in + order to verify behavior on a private index setter: + + [TestMethod] + [Isolated] + public void VerifyIndexSetterWasCalled() + { + LogFile fake = Isolate.Fake.Instance<LogFile>(Members.CallOriginal); + + // set the position to write at - this will be used for internal index value + fake.SetPosition(10); + fake.Write("Hello World"); + + // Verify a set call to the LogFile's internal indexer was made at the correct index + Isolate.Verify.NonPublic.Indexer.WasSetCalled(fake).WithIndexAndValue(10, "Hello World"); + } + + // Excerpt from class under test + public class LogFile + { + private int currentPosition = 0; + public void Write(string message) + { + this[currentPosition] = message; + } + + public void SetPosition(int value) + { + currentPosition = value; + } + + protected string this[int line] + { + set { WriteToFile(line, value); } + } + } + + + + + + + Verify a call has not been made to a non-private index getter + + The fake object to verify index behavior on + + This example shows how to use Isolate.NonPublic.Indexer.WasNotCalledGet() + in order to verify a private index getter has not been called: + + [TestMethod] + [Isolated] + public void VerifyIndexGetterWasNotCalled() + { + LogFile fake = Isolate.Fake.Instance<LogFile>(Members.CallOriginal); + + string line = fake.GetLineAt(10) + + // The internal index was used to retrieve the log line - this verification should fail + Isolate.Verify.NonPublic.Indexer.WasNotCalledGet(fake); + } + + + // Excerpt from class under test + public class LogFile + { + public string GetLineAt(int lineNumber) + { + return this[lineNumber]; + } + + protected string this[int line] + { + get { return ...; } + } + } + + + + + + Verify a call has not been made to a non-private index setter + + The fake object to verify index behavior on + + This example shows how to use Isolate.NonPublic.Indexer.WasNotCalledSet() + in order to verify a private index getter has not been called: + + [TestMethod] + [Isolated] + public void VerifyIndexSetterWasNotCalled() + { + LogFile fake = Isolate.Fake.Instance<LogFile>(Members.CallOriginal); + + // set the position to write at - this will be used for internal index value + fake.SetPosition(10); + fake.Write("Hello World"); + + // The internal index was set during the Write operation so this verification will fail + Isolate.Verify.NonPublic.Indexer.WasNotCalledSet(fake); + } + + // Excerpt from class under test + public class LogFile + { + private int currentPosition = 0; + public void Write(string message) + { + this[currentPosition] = message; + } + + public void SetPosition(int value) + { + currentPosition = value; + } + + protected string this[int line] + { + set { WriteToFile(line, value); } + } + } + + + + + + Returned by Isolate.Verify., this interface is used to verify an index + getter was called with a specific index. + + + + + Verify the index getter was made with the specific index location + + The index location value to verify + The type of the index used. Can be inferred from + + This method is used to complement verifying index getter calls, using + Isolate.Verify.NonPublic.Indexer., with specific index location verification. + + + This example shows how to use Isolate.NonPublic.Indexer.WasCalledGet() in order to verify behavior on a private index setter: + + [TestMethod] + [Isolated] + public void VerifyIndexGetterWasCalled() + { + LogFile fake = Isolate.Fake.Instance<LogFile>(Members.CallOriginal); + + string line = fake.GetLineAt(10); + + // Verify a get call to the LogFile's internal indexer was made + Isolate.Verify.NonPublic.Indexer.WasGetCalled(fake).WithIndex(10); + } + + // Excerpt from class under test + public class LogFile + { + public string GetLineAt(int index) + { + return this[index]; + } + + internal string this[int line] + { + get { return GetFromLog(line); } + } + } + + + + + + + Verify the index setter was called with a specific index location and setter value + + The index location value to verify + The setter value to verify + The type of the index used. Can be inferred from + The type of the setter value used. Can be inferred from + + This method is used to complement verifying index setter calls, using + Isolate.Verify.NonPublic.Indexer., with specific + index location and value verification. + + + This example shows how to use Isolate.NonPublic.Indexer.WasCalledSet() in + order to verify behavior on a private index setter: + + [TestMethod] + [Isolated] + public void VerifyIndexSetterWasCalled() + { + LogFile fake = Isolate.Fake.Instance<LogFile>(Members.CallOriginal); + + // set the position to write at - this will be used for internal index value + fake.SetPosition(10); + fake.Write("Hello World"); + + // Verify a set call to the LogFile's internal indexer was made + Isolate.Verify.NonPublic.Indexer.WasSetCalled(fake).WithIndexAndValue(10, "Hello World"); + } + + // Excerpt from class under test + public class LogFile + { + private int currentPosition = 0; + public void Write(string message) + { + this[currentPosition] = message; + } + + public void SetPosition(int value) + { + currentPosition = value; + } + + protected string this[int line] + { + set { WriteToFile(line, value); } + } + } + + + + + + + Returned by Isolate.NonPublic., this interface + contains methods for defining behavior for non public methods, as will as a modifier for applying behavior for + generic methods + + + + + Specifies generic type arguments that apply to a non-public method to set behavior on. The behavior will + be set only for a method bound to the passed type arguments + + The first generic type argument the method binds to + Optional. Further generic type arguments the method binds to. + an INonPublicMethodBehavior interface reference + + WithGenericArguments() modifies a call to Isolate.NonPublic.. + Due to the fluent nature of the AAA API it should be used with its proceeding methods; see . + + + Here is an example how to use WhenCalled with WithGenericArguments in order to simulate an error creating + a factory generated object: + + [TestMethod] + [Isolated] + public void ThrowExceptionFromGenericMethod_SimulateErrorCreatingLogger() + { + LoggerFactory fake = Isolate.Fake.Instance<LoggerFactory>(); + + // Set the logger factory to throw an exception when trying to retrieve a RealLogger + Isolate.NonPublic.WhenCalled(fake, "GetLogger"). + WithGenericArguments(typeof(RealLogger)). + WillThrow(new ArgumentNullException()); + + // The following method call is not faked because it does not match the specified generic + // type arguments - no exception is thrown + DiskLogger logger = fake.GetLogger<DiskLogger>(); + + // This call will throws an exception as specified + try + { + fake.GetLogger<RealLogger>(); + Assert.Fail("Retrieving a RealLogger should have failed with an ArgumentNullException"); + } + catch(ArgumentNullException) + { + } + } + + + + + Used to clean up the defined expectations. This attribute cant be inherited. + Any method marks with this attribute will clean all set expectation + after the test is done. A marked class will do this for any test defined in + it. The attribute can be replaced with the method. + + + [TestFixture] + [Isolated] // clear all mocks between tests + public TestClass + { + [Test] + public void MyTest1() + { + // the test code + } + } + + + < TestFixture >_ + < Isolated >_ ' clear all mocks between tests + Public class TestClass + < Test >_ + Public Sub MyTest1() + ' the test code + End Sub + End Class + + + + + + Called by the framework instead of the original method. This will run the original method and + afterwards clear the MockManager. + + the result of the original method + + + + Returned by , this interface contains methods for faking and setting + behavior for method calls on non public methods, properties and indexers. + + + + + Sets behavior for a specific method on a an object + + The object to set method behavior on. + The name of a method to set behavior on. + An interface reference. + + Because of the nature of fluent interface, WhenCalled should be used with its proceeding methods. + See + + Here is an example how to use WhenCalled in order to ignore (stub) a private call: + + [TestMethod] + [Isolated] + public void StubPrivateMethod_DoNotWriteToDisk() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + // Avoid performing actual write to disk by ignoring (stubbing) a private call + Isolate.NonPublic.WhenCalled(fake, "WriteToDisk").IgnoreCall(); + + // The private call is stubbed so no actual disk writes are performed + fake.Log("Hello World"); + + Assert.AreEqual(1, fake.LineCount); + } + + + + + + + + Sets behavior for a specific static method on a class + + The type to set method behavior on. Applies to static methods. + The name of a static method to set behavior on. + An interface reference. + + Because of the nature of fluent interface, WhenCalled should be used with its proceeding methods. + See + + Here is an example how to use WhenCalled in order to ignore (stub) a private call: + + [TestMethod] + [Isolated] + public void StubPrivateStaticMethod_FactoryCreate() + { + Isolate.Fake.StaticMethods<LoggerFactory>(); + + // Avoid performing to network access by ignoring (stubbing) a private call + Isolate.NonPublic.WhenCalled(typeof(LoggerFactory), "ReportToControllerServer").IgnoreCall(); + + // The private method is stubbed and the unit test will not perform external calls + RealLogger logger = LoggerFactory.CreateLogger(); + + Assert.IsNotNull(logger); + } + + + + + + + + A read only property, used to set behavior on non-public properties + + + An reference + + + Because of the nature of fluent interface, you need to use Property with one of its proceeding methods, see . + + When handling non public (private, protected, internal) properties all access to property names is string-based. + + + + This example shows how to use Isolate.NonPublic.Property in order to set behavior on a private property getter: + + [TestMethod] + [Isolated] + public void SetPrivatePropertyBehavior_ChangeReturnValue() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + // have private RealLogger.IsDiskFull property return true to simulate an error + Isolate.NonPublic.Property.WhenCalledGet(fake, "IsDiskFull").WillReturn(true); + + // Because we simulated a disk full error, this call should throw an exception + try + { + fake.Log("Hello World"); + Assert.Fail("fake.Log() should have thrown because IsDiskFull is true"); + } + catch(OutOfDiskSpaceException) + { + } + } + + + + + + + A read only property, used to set behavior on non-public indexers + + + An reference + + + Because of the nature of fluent interface, you need to use Indexer with one of its proceeding methods, see . + + + This example shows how to use Isolate.NonPublic.Indexer in order to set behavior on a private index getter: + + [TestMethod] + [Isolated] + public void SetPrivateIndexBehavior_ChangeReturnValue() + { + LogFile fake = Isolate.Fake.Instance<LogFile>(Members.CallOriginal); + + // have private LogFile[i] index return a specified log line + Isolate.NonPublic.Indexer.WhenCalledGet(fake).WillReturn("Info: this is a test log line"); + + // We set the value of the next log line the internal implementation will look at + Assert.AreEqual("this is a test log line", fake.GetNextLogLine(Level.Info)); + } + + + + + + + Returned by Isolate.NonPublic., this interface contains methods for faking and setting + behavior for non-public (private, protected and internal) index get and set calls + + + + + Sets specific behavior for a non-public index getter on a an object + + The object to set indexer behavior for. + An interface reference. + + Because of the nature of fluent interface, WhenGetCalled should be used with its proceeding methods. + See . + + Here is an example how to use Isolate.NonPublic.Indexer.WhenGetCalled() in order to set return value for an index call: + + [TestMethod] + [Isolated] + public void ChangeIndexGetReturnValue() + { + RealLogger fake = Isolate.Fake.Instance<LogContainer>(); + + // Set the internal indexer to return a specific value + Isolate.NonPublic.Indexer.WhenGetCalled(fake).WillReturn("hello"); + + // The object under test uses the private index get result as part of a calculation + string result = fake.GetStringAt(10); + Assert.AreEqual("hello", result); + } + + // Excerpt from class under test + public class LogContainer + { + // method under test + public string GetStringAt(int line) + { + return this[line]; + } + + private string fileName = ... + + // private indexer + private string this[int line] + { + get { return ReadFromFile(fileName, line); } + } + + } + + + + + + + + Sets specific behavior for a non-public index set on a an object + + The object to set indexer behavior for. + An interface reference. + + Because of the nature of fluent interface, WhenSetCalled should be used with its proceeding methods. + See . + + Here is an example how to use Isolate.NonPublic.Indexer.WhenSetCalled() in order to simulate a memory error on index write access: + + [TestMethod] + [Isolated] + [ExpectedException(typeof(OutOfMemoryException)) + public void ThrowExceptionFromIndexSet_SimulateMemoryError() + { + RealLogger fake = Isolate.Fake.Instance<LogContainer>(); + + // Set the internal indexer to throw an exception on set + Isolate.NonPublic.Indexer.WhenSetCalled(fake).WillThrow(new OutOfMemoryException()); + + // The object under test uses the private index setter when writing to log + fake.WriteToLog("hello"); + } + + // Excerpt from class under test + public class LogContainer + { + // method under test + public string WriteToLog(string message) + { + this[currentLine] = message; + currentLine++; + } + + private string fileName = ... + private int currentLine = 0; + + // private indexer + private string this[int line] + { + set { InternalWrite(fileName, line, value); } + } + } + + + + + + + + Interface for specifying fake object creation settings. The interface is typed by the preceeding Faker property. + + + This interface is returned by the property. + + + + + Overloaded. Returns a fake instance of type T. Using this overload is equal to using Members.MustSpecifyReturnValues. + + The type of fake object to create. + A fake instance of type T. + Members Enum + + + Here is an example how to use Instance in order to fake a RealLogger instance: + + [TestMethod] + [Isolated] + public void FakeAnInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Count = 0; + + // This call is faked because we used the default Instance overload - count should not increment + fake.Increment(); + + Assert.AreEqual(0, fake.Count); + } + + + + + + Overloaded. Returns a fake instance of type T. + + + + The type of the fake instance to be created. + + Can be one of the following values: + + + Members ValueDescription + + Members.MustSpecifyReturnValues + All void calls are ignored. Unless using on methods that return values and properties, they will throw a . + + + + Members.ReturnNulls + All void calls are ignored. Unless using on methods that return values and properties, they will return Null values (or zero for value types). + + + + Members.CallOriginal + All methods are called. Using allow to change this behavior. + + + + Members.ReturnRecursiveFakes + Default. All void calls are ignored. When calling the fake's methods returning values or properties, they will return a fake value, which presents this behavior recursively. Any deep call will never return a Null value. + + + + + A fake instance of Type T. + + + + The following test shows the faking an instance using Members.MustSpecifyReturnValue: + + [TestMethod] + [Isolated] + public void FakeAnInstance_MustSpecifyReturnValues() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.MustSpecifyReturnValues); + + fake.Count = 0; + + // This call is faked because we used MustSpecifyReturnValues - count should not increment + fake.Increment(); + Assert.AreEqual(0, fake.count); + + // The following statement will throw, because we didn't set behavior on IntCall method. + int x = fake.IntCall(); + } + + The next test shows the CallOriginal setting on Instance: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseCallOriginal() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Count = 0; + + // This call is not faked. Count should be incremented. + fake.Increment(); + Assert.AreEqual(1, fake.Count); + } + + The next test shows what happens when using ReturnNulls: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseReturnNulls() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnNulls); + + fake.Count = 0; + // This call is faked because we set faked method behavior using ReturnNulls + fake.Increment(); + Assert.AreEqual(0, fake.Count); + + // Since we're returning Null by default the following Assert passes + Assert.IsNull(fake.IntCall()); + } + + Finally, using recursive faking, this test should pass: + + [TestMethod] + [Isolated] + public void RecursiveStubsChain() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnRecursiveFakes); + + // This method returns a value type, and therefore, returns a fake 0. + Assert.AreEqual(0, fake.ReturnFive()); + + // This method returns an object, and therefore returns a non-null object + Assert.IsNotNull(fake.GetSon()); + + // And the result of GetSon also returns a non-null object + Assert.IsNotNull(fake.GetSon().GetNephew()); + } + + + + + + Overloaded. Returns a fake instance of type T. + + + + The type of the fake instance to be created. + + Can be one of the following values: + + + Members ValueDescription + + Members.MustSpecifyReturnValues + All void calls are ignored. Unless using on methods that return values and properties, they will throw a . + + + + Members.ReturnNulls + All void calls are ignored. Unless using on methods that return values and properties, they will return Null values (or zero for value types). + + + + Members.CallOriginal + All methods are called. Using allow to change this behavior. + + + + Members.ReturnRecursiveFakes + Default. All void calls are ignored. When calling the fake's methods returning values or properties, they will return a fake value, which presents this behavior recursively. Any deep call will never return a Null value. + + + + + + Can Be One OF the following values: + + + ConstructorWillBe ValueDescription + + + ConstructorWillBe.Ignored + Constructor will not be executed when creating the fake object + + + ConstructorWillBe.Called + Execute Constructor when creating the fake object + + + + A fake instance of Type T. + + + + The following test shows the faking an instance using Members.MustSpecifyReturnValue: + + [TestMethod] + [Isolated] + public void FakeAnInstance_MustSpecifyReturnValues() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.MustSpecifyReturnValues, ConstructorWillBe.Ignored); + + fake.Count = 0; + + // This call is faked because we used MustSpecifyReturnValues - count should not increment + fake.Increment(); + Assert.AreEqual(0, fake.count); + + // The following statement will throw, because we didn't set behavior on IntCall method. + int x = fake.IntCall(); + } + + The next test shows the CallOriginal setting on Instance: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseCallOriginal() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal, ConstructorWillBe.Ignored); + + // Because constructor was not called Count was not initialized + Assert.AreEqual(0, fake.Count); + + // This call is not faked. Count should be incremented. + fake.Increment(); + Assert.AreEqual(1, fake.Count); + } + + The next test shows what happens when using ReturnNulls: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseReturnNulls() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnNulls, ConstructorWillBe.Ignored); + + fake.Count = 0; + // This call is faked because we set faked method behavior using ReturnNulls + fake.Increment(); + Assert.AreEqual(0, fake.Count); + + // Since we're returning Null by default the following Assert passes + Assert.IsNull(fake.IntCall()); + } + + Finally, using recursive faking, this test should pass: + + [TestMethod] + [Isolated] + public void RecursiveStubsChain() + { + // We create a fake after running the real constructor that sets count field to 5 + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnRecursiveFakes, ConstructorWillBe.Called); + + // Because Constructor was called fake.count field was initialized + Assert.AreEqual(5, fake.count); + + // This method returns a value type, and therefore, returns a fake 0. + Assert.AreEqual(0, fake.ReturnFive()); + + // This method returns an object, and therefore returns a non-null object + Assert.IsNotNull(fake.GetSon()); + + // And the result of GetSon also returns a non-null object + Assert.IsNotNull(fake.GetSon().GetNephew()); + } + + + + + + Overloaded. Returns a fake instance of type T. + + + + The type of the fake instance to be created. + + Can be one of the following values: + + + Members ValueDescription + + Members.MustSpecifyReturnValues + All void calls are ignored. Unless using on methods that return values and properties, they will throw a . + + + + Members.ReturnNulls + All void calls are ignored. Unless using on methods that return values and properties, they will return Null values (or zero for value types). + + + + Members.CallOriginal + All methods are called. Using allow to change this behavior. + + + + Members.ReturnRecursiveFakes + Default. All void calls are ignored. When calling the fake's methods returning values or properties, they will return a fake value, which presents this behavior recursively. Any deep call will never return a Null value. + + + + + + Can Be One of the following values: + + + ConstructorWillBe ValueDescription + + + ConstructorWillBe.Ignored + Constructor will not be executed when creating the fake object + + + ConstructorWillBe.Called + Execute Constructor when creating the fake object + + + + + The parameters to pass to a specific constructor. + If constructor behavior is set to and this value isn't empty a will be throw + + A fake instance of Type T. + + + + The following test shows the faking an instance using Members.MustSpecifyReturnValue: + + [TestMethod] + [Isolated] + public void FakeAnInstance_MustSpecifyReturnValues() + { + // Call class constructor passing a number that will be passed to count field + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.MustSpecifyReturnValues, ConstructorWillBe.Called, 10); + + // Check that the value we've passed to the constructor was passed to the field + Assert.AreEqual(10, fake.count); + fake.Count = 0; + + // This call is faked because we used MustSpecifyReturnValues - count should not increment + fake.Increment(); + Assert.AreEqual(0, fake.count); + + // The following statement will throw, because we didn't set behavior on IntCall method. + int x = fake.IntCall(); + } + + The next test shows the CallOriginal setting on Instance: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseCallOriginal() + { + // Call class constructor passing a number that will be passed to count field + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal, ConstructorWillBe.Called, 10); + + // Check that the value we've passed to the constructor was passed to the field + Assert.AreEqual(10, fake.count); + + // Because constructor was not called Count was not initialized + Assert.AreEqual(0, fake.Count); + + // This call is not faked. Count should be incremented. + fake.Increment(); + Assert.AreEqual(1, fake.Count); + } + + The next test shows what happens when using ReturnNulls: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseReturnNulls() + { + // Call class constructor passing a number that will be passed to count field + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnNulls, ConstructorWillBe.Called, 10); + + // Check that the value we've passed to the constructor was passed to the field + Assert.AreEqual(10, fake.count); + + fake.Count = 0; + // This call is faked because we set faked method behavior using ReturnNulls + fake.Increment(); + Assert.AreEqual(0, fake.Count); + + // Since we're returning Null by default the following Assert passes + Assert.IsNull(fake.IntCall()); + } + + Finally, using recursive faking, this test should pass: + + [TestMethod] + [Isolated] + public void RecursiveStubsChain() + { + // Call class constructor passing a number that will be passed to count field + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnRecursiveFakes, ConstructorWillBe.Called, 10); + + // Check that the value we've passed to the constructor was passed to the field + Assert.AreEqual(10, fake.count); + + // This method returns a value type, and therefore, returns a fake 0. + Assert.AreEqual(0, fake.ReturnFive()); + + // This method returns an object, and therefore returns a non-null object + Assert.IsNotNull(fake.GetSon()); + + // And the result of GetSon also returns a non-null object + Assert.IsNotNull(fake.GetSon().GetNephew()); + } + + + + + + Overloaded. Fake future calls to static constructors of the given type. + + The type for which to fake static constructor calls + + Thown if the static constructor for the provided type has already been called, if an + instance fake of the type has already been created or if FakeStaticConstructors has already + been called for it. + + + This overload for FakeStaticConstructor receives a generic parameter. Because static classes cannot be instantiated, they + also cannot be used as generic type parameters. In order to fake the static constructors for a static class, use the non + generic overload which receives a Type parameter. + + + This example shows using Isolate.Fake.StaticConstructor() to fake a call to a static constructor + + [TestMethod] + [Isolated] + public void FakeStaticConstructor_CCtorNotCalled() + { + Isolate.Fake.StaticConstructor<TestClass>() + + TestClass.DoSomething(); // this causes the static constructor to be called + + // the call to the static constructor was faked so the flag equals false + Assert.IsFalse(TestClass.TrueIfCCtorHappened); + } + + + + + + + Overloaded. Fake future calls to static constructors of the given type. + + The type for which to fake static constructor calls + + Thown if the static constructor for the provided type has already been called, if an + instance fake of the type has already been created or if FakeStaticConstructors has already + been called for it. + + + This overload for FakeStaticConstructor receives a Type parameter which represents the class to fake static constructors for, + and should be used when faking constructors for static classes. For other non-static classes it is generally recommended to use the + generic overload , which receives the class as a generic type argument. + + + This example shows using Isolate.Fake.StaticConstructor() to fake a call to a static constructor + + [TestMethod] + [Isolated] + public void FakeStaticConstructor_CCtorNotCalled() + { + Isolate.Fake.StaticConstructor( typeof(StaticTestClass)) + + StaticTestClass.DoSomething(); // this causes the static constructor to be called + + // the call to the static constructor was faked so the flag equals false + Assert.IsFalse(StaticTestClass.TrueIfCCtorHappened); + } + + + + + + + Overloaded. Fakes all static methods for type T. Using this overload is equal to using Members.MustSpecifyReturnValues. + + The type to fake static methods for. + Members Enum + + Static class cannot be used as type argument. + Use IFaker.StaticMethods(Type type) or IFaker.StaticMethods(Type type, Members behavior) instead. + + + This example shows using FakeStaticMethods to stub all static void calls for a class + + [TestMethod] + [Isolated] + public void FakeStaticMethods_StubIncrementMethod() + { + Isolate.Fake.StaticMethods<LoggerFactory>(); + + LoggerFactory.Count = 0; + // This call is faked because we used the default overload for FakeStaticMethods - + // IncrementCount() is not really performed + LoggerFactory.IncrementCount(); + + Assert.AreEqual(0, LoggerFactory.Count); + } + + + + + + Overloaded. Fakes all static methods for the provided type. Using this overload is equal to using Members.MustSpecifyReturnValues. + + The type to fake static methods for. + Members Enum + + This overload receives a Type parameter representing the class to fake static methods for, and should be used + when faking methods for static classes. For other non-static classes it is generally recommended to use the + generic overload , which receives the class as a generic type argument. + + + This example shows using FakeStaticMethods to stub all static void calls for a class + + [TestMethod] + [Isolated] + public void FakeStaticMethods_StubIncrementMethod() + { + Isolate.Fake.StaticMethods( typeof(LoggerFactory)); + + LoggerFactory.Count = 0; + // This call is faked because we used the default overload for FakeStaticMethods - + // IncrementCount() is not really performed + LoggerFactory.IncrementCount(); + + Assert.AreEqual(0, LoggerFactory.Count); + } + + + + + + + Overloaded. Fakes all static methods for type T. + + The type to fake static methods for. + + Can be one of the following values: + + + Members ValueDescription + + Members.MustSpecifyReturnValues + Default. All void calls are ignored. Unless using on methods that return values and properties, they will throw a . + + + + Members.ReturnNulls + All void calls are ignored. Unless using on methods that return values and properties, they will return Null values (or zero for value types). + + + + Members.CallOriginal + All methods are called. Using allow to change this behavior. + + + + Members.ReturnRecursiveFakes + All void calls are ignored. When calling the fake's methods returning values or properties, they will return a fake value, which presents this behavior recursively. Any deep call will never return a Null value. + + + + + A fake instance of Type T. + + Static class cannot be used as type argument. + Use IFaker.StaticMethods(Type type) or IFaker.StaticMethods(Type type, Members behavior) instead. + + + + + + The following test shows the default behavior of FakeStaticMethods(): + + [TestMethod] + [Isolated] + public void FakeStaticMethods_UseDefault() + { + Isolate.Fake.StaticMethods<LoggerFactory>(); + + LoggerFactory.Count = 0; + // This call is faked because we used the default overload for FakeStaticMethods - + // IncrementCount() is not really performed + LoggerFactory.IncrementCount(); + + Assert.AreEqual(0, LoggerFactory.Count); + + // The following statement will throw, because we didn't set behavior on GetCount() method. + int x = LoggerFactory.GetCount(); + } + + The next test shows the CallOriginal setting for FakeStaticMethods(): + + [TestMethod] + [Isolated] + public void FakeStaticMethods_UseCallOriginal() + { + Isolate.Fake.StaticMethods<LoggerFactory>(Members.CallOriginal); + + LoggerFactory.Count = 0; + + // This call is not faked. Count should be incremented. + LoggerFactory.Increment(); + Assert.AreEqual(1, fake.Count); + } + + The next test shows what happens when using ReturnNulls: + + [TestMethod] + [Isolated] + public void FakeStaticMethods_UseReturnNulls() + { + Isolate.Fake.StaticMethods<LoggerFactory>(Members.ReturnNulls); + + LoggerFactory.Count = 0; + // This call is faked because we set faked method behavior using ReturnNulls + LoggerFactory.Increment(); + Assert.AreEqual(0, fake.Count); + + // Since we're returning Null by default the following Assert passes + Assert.IsNull(LoggerFactory.GetLogger()); + } + + Finally, using recursive faking, this test should pass: + + [TestMethod] + [Isolated] + public void RecursiveStubsChain() + { + Isolate.Fake.StaticMethods<LoggerFactory>(Members.ReturnRecursiveFakes); + + // This method returns a value type, and therefore, returns a fake 0. + Assert.AreEqual(0, LoggerFactory.GetLoggerCount()); + + // This method returns an object, and therefore returns a non-null object + Assert.IsNotNull(LoggerFactory.GetLogger()); + + // And the result of GetLogger also returns a non-null object + Assert.IsNotNull(LoggerFactory.GetLogger().GetWriter()); + } + + + + + + Overloaded. Fakes all static methods for the given type. + + The type to fake static methods for. + + Can be one of the following values: + + + Members ValueDescription + + Members.MustSpecifyReturnValues + Default. All void calls are ignored. Unless using on methods that return values and properties, they will throw a . + + + + Members.ReturnNulls + All void calls are ignored. Unless using on methods that return values and properties, they will return Null values (or zero for value types). + + + + Members.CallOriginal + All methods are called. Using allow to change this behavior. + + + + Members.ReturnRecursiveFakes + All void calls are ignored. When calling the fake's methods returning values or properties, they will return a fake value, which presents this behavior recursively. Any deep call will never return a Null value. + + + + + A fake instance of Type T. + + + + + + This overload receives a Type parameter representing the class to fake static methods for, and should be used + when faking methods for static classes. For other non-static classes it is generally recommended to use the + generic overload , which receives the class as a generic type argument. + + + The following test shows the default behavior of FakeStaticMethods(): + + [TestMethod] + [Isolated] + public void FakeStaticMethods_UseDefault() + { + Isolate.Fake.StaticMethods(typeof (LoggerFactory)); + + LoggerFactory.Count = 0; + // This call is faked because we used the default overload for FakeStaticMethods - + // IncrementCount() is not really performed + LoggerFactory.IncrementCount(); + + Assert.AreEqual(0, LoggerFactory.Count); + + // The following statement will throw, because we didn't set behavior on GetCount() method. + int x = LoggerFactory.GetCount(); + } + + The next test shows the CallOriginal setting for FakeStaticMethods(): + + [TestMethod] + [Isolated] + public void FakeStaticMethods_UseCallOriginal() + { + Isolate.Fake.StaticMethods(typeof (LoggerFactory), Members.CallOriginal); + + LoggerFactory.Count = 0; + + // This call is not faked. Count should be incremented. + LoggerFactory.Increment(); + Assert.AreEqual(1, fake.Count); + } + + The next test shows what happens when using ReturnNulls: + + [TestMethod] + [Isolated] + public void FakeStaticMethods_UseReturnNulls() + { + Isolate.Fake.StaticMethods(typeof (LoggerFactory), Members.ReturnNulls); + + LoggerFactory.Count = 0; + // This call is faked because we set faked method behavior using ReturnNulls + LoggerFactory.Increment(); + Assert.AreEqual(0, fake.Count); + + // Since we're returning Null by default the following Assert passes + Assert.IsNull(LoggerFactory.GetLogger()); + } + + Finally, using recursive faking, this test should pass: + + [TestMethod] + [Isolated] + public void RecursiveStubsChain() + { + Isolate.Fake.StaticMethods(typeof (LoggerFactory), Members.ReturnRecursiveFakes); + + // This method returns a value type, and therefore, returns a fake 0. + Assert.AreEqual(0, LoggerFactory.GetLoggerCount()); + + // This method returns an object, and therefore returns a non-null object + Assert.IsNotNull(LoggerFactory.GetLogger()); + + // And the result of GetLogger also returns a non-null object + Assert.IsNotNull(LoggerFactory.GetLogger().GetWriter()); + } + + + + + + Returned by , this interface contains methods for verifying the method calls and checking their arguments. + + + + + Overloaded. Verifies that a method was called, without checking its arguments. + + A void method in the form of a Lambda Expression that we want to verify if was called. + + Thrown if the method, or chain of methods was not called. + + + This can also be a chain of methods. In that case, the verification is on the entire chain, and not part of it. + When arguments are specified, they are ignored in the verification. + + + This example shows how to use Isolate.Verify in order to check a method was called: + + [TestMethod] + [Isolated] + public void VerifyMethodWasCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Write("Hello"); + + // We did not check the call for argument matching so this verification should pass + Isolate.Verify.WasCalledWithAnyArguments(() => fake.Write("Goodbye")); + } + + + + + + + Overloaded. Verifies that a method was called, without checking its arguments. + + A method returning a value in the form of a Lambda Expression that we want to verify if was called. + + Thrown if the method, or chain of methods was not called. + + + This can also be a chain of methods. In that case, the verification is on the entire chain, and not part of it. + When arguments are specified, they are ignored in the verification. + + + This example shows how to use Isolate.Verify in order to check a method was called: + + [TestMethod] + [Isolated] + public void VerifyMethodWasCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnNulls); + + int x = fake.GetCount(); + + Isolate.Verify.WasCalledWithAnyArguments(() => fake.GetCount()); + } + + + + + + Overloaded. Verifies that a method was called, and checking its arguments. + + A void method in the form of a Lambda Expression that we want to verify if was called. + + Thrown if the method, or chain of methods was not called with the specified arguments. + + + This can also be a chain of methods. In that case, the verification is on the entire chain, and not part of it. + + + This example shows how to use Isolate.Verify in order to check a method was called + with a specific set of arguments: + + [TestMethod] + [Isolated] + public void VerifyMethodWasCalled_WithExactArguments() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Write("Hello"); + + // As we're verifying the call was made with exact arguments, this verification should fail + Isolate.Verify.WasCalledWithExactArguments(() => fake.Write("Goodbye")); + } + + + + + + Overloaded. Verifies that a method was called, and checking its arguments. + + A method returning a value in the form of a Lambda Expression that we want to verify if was called. + + Thrown if the method, or chain of methods was not called with the specified arguments. + + + This can also be a chain of methods. In that case, the verification is on the entire chain, and not part of it. + + + This example shows how to use Isolate.Verify in order to check a method was called + with a specific set of arguments: + + [TestMethod] + [Isolated] + public void VerifyMethodWasCalled_WithExactArguments() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Write("Hello"); + + // As we're verifying the call was made with exact arguments, this verification should fail + Isolate.Verify.WasCalledWithExactArguments(() => fake.Write("Goodbye")); + } + + + + + + Overloaded. Verifies that a method was not called regardless of parameters. + + A void method in the form of a Lambda Expression that we want to verify if was called. + + Thrown if the method, or chain of methods was called at least once. + + + This can also be a chain of methods. In that case, the verification is on the entire chain, and not part of it. + + + This example shows how to use Isolate.Verify in order to check a method was not called + + [TestMethod] + [Isolated] + public void VerifyMethodWasNotCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Increment(); + + // This verification should fail + Isolate.Verify.WasNotCalled(() => fake.Increment()); + } + + + + + + Overloaded. Verifies that a method was not called regardless of parameters. + + A method returning a value in the form of a Lambda Expression that we want to verify if was called. + + Thrown if the method, or chain of methods was called at least once. + + + This can also be a chain of methods. In that case, the verification is on the entire chain, and not part of it. + + + This example shows how to use Isolate.Verify in order to check a method was not called + + [TestMethod] + [Isolated] + public void VerifyMethodWasNotCalled() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Increment(); + + // This verification should fail + Isolate.Verify.WasNotCalled(() => fake.Increment()); + } + + + + + + Provides an entry point to verify non-public (private, protected, internal) members + + + + + Interface used as part of the future object pattern. The pattern allows swapping of a + given instance with a mocked instance on its creation + + + + Here is an example how to use Isolate.Swap.NextInstance in order to fake a future instance: + + [TestMethod] + [Isolated] + public void SwapAFutureInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + Isolate.Swap.NextInstance<RealLogger>().With(fake); + + Isolate.WhenCalled(() => fake.Increment()).IgnoreCall(); + + // This object is swapped with the fake + RealLogger logger = new RealLogger(); + + // Make sure Count is reset + logger.Count = 0; + + // This call is faked - count should not increment + logger.Increment(); + + Assert.AreEqual(0, logger.Count); + } + + + + + + Specify the fake instance that will replace the created instance. + + the fake instance that will replace the created instance + + + + Specify that an exception will be thrown the next time a construction is encountered for the type + + The exception that will be thrown when the constructor is called + + + + Specifies that the behavior will only be set on method calls with the exact arguments. + + + + WithExactArguments() is a completing statement for . + + + + This example shows how to use WithExactArguments() to set behavior on specific method call + + [TestMethod] + [Isolated] + public void WithExactArguments_DifferentArgsReturnDifferentValues() + { + // create a fake logger which will behave as the original one + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + // Set return value according to exact arguments + Isolate.WhenCalled(() => fake.VoidCallWithArg(0)).WithExactArguments().IgnoreCall(); + Isolate.WhenCalled(() => fake.VoidCallWithArg(1)).WithExactArguments().CallOriginal(); + Isolate.WhenCalled(() => fake.VoidCallWithArg(2)).WithExactArguments().WillThrow(new Exception("")); + + // Check that the correct value returned + fake.VoidCallWithArg(0); // This call will be ignored + fake.VoidCallWithArg(1); // This call will call the real method + fake.VoidCallWithArg(2); // This call will throw an exception + } + + + + + + Interface for performing object to object method call swapping + + + This interface is returned by calling Isolate.Swap.. Follow it by calling + the completing statement. + + + + + + + Completes swapping method calls for an object. Is called as a completing statement for Isolate.Swap., + and defines the target object to perform swapping on. + + The object whose implementation should be used + An interface reference. + + When a method is called on the swapped object, it is replaced with a corresponding implementation (a method + with the same signature) on the swapping object. This means that the swapped object will start behaving like + the object it was swapped with for all methods they have in common. + + When a method is called on the swapped object that does not exist in the target object, it will be called on the original + object. + + + + If there are no compatible methods to swap between the swapping source and target objects. + + + This example shows how to use Isolate.Swap.. in order to + redirect calls from an object to a stand-in object: + + [TestMethod] + [Isolated] + public void SwapCallsOnObject_CallsRedirectedToTargetObject() + { + // Create the object under test + RealLogger logger = new RealLogger(); + // Create the object calls will be redirected to + TestLogger swapped = new TestLogger(); + + // Redirect any calls from the object under test to the swapping target + Isolate.Swap.CallsOn(logger).WithCallsTo(swapped); + + // logger.Write() is redirected to TestLogger.Write() which writes to console instead of disk + logger.Write("Hello World"); + + // We can still verify the call to logger.Write() happened + Isolate.Verify.WasCalledWithAnyArguments(() => logger.Write("")); + } + + // excerpt code for the class under test: + public class RealLogger + { + string logFilePath = ...; + public void Write(string toWrite) + { + logFile.WriteAllText(logFilePath, toWrite); + } + } + + // excerpt code for the replacement class: + public class TestLogger + { + public void Write(string toWrite) + { + Console.WriteLine("RealLogger.Write() was called with {0}", toWrite); + } + } + + + + + + Interface for tweaking behavior for methods returning collection types. This can be used to replace collection values returned + by a method or property with another test data collection. + This interface is returned by the method. + + + + + Swaps a collection returned by a method or property with a collection of test data. Follows a call to + . + + The collection to use instead of the replaced collection + + + This method is used as a completing statement to , and is used to + replace the collection in the preceeding statement with the provided collection. + This is useful when the code under test uses collection data that is prepared externally and then iterated over. + The collection containing this data can be swapped with a test data collection prepared during the test set up and thus remove + the dependency on the code populating the collection. + + + Note: because Typemock Isolator does not currently support faking objects implemented in MsCorLib.dll, + the source collection used with WhenCalled() cannot be one implemented in MsCorLib, such as + and . + + + + If the lambda expression provided in Isolate.WhenCalled() does not + evaluate to an object implementing . + + + This example shows how to use Isolate.. in order to + swap a collection data for test data: + + [TestMethod] + [Isolated] + public void SwapCollectionValues_ReplaceCollectionWithTestData() + { + // Create a logger to use as test data + RealLogger logger = new RealLogger(); + // Swap the logger collection for the class under test with a collection containing the prepared test data + Isolate.WhenCalled(() => LoggerFactory.Loggers).WithValuesFrom(new[] { logger }); + + // Verify the GetLogger() method returned the existing logger instead of creating a new one. + RealLogger actual = LoggerFactory.GetLogger(); + Assert.AreSame(logger, actual); + } + + + + + + A behavior setting on how the fake object is created. + + + + + All void calls are ignored. Unless using WhenCalled on methods that return values and properties, they will throw a . + + + + + All methods are called. Using WhenCalled allow to change this behavior. + + + + + All void calls are ignored. Unless using WhenCalled on methods that return values and properties, they will return Null values (or zero for value types). + + + + + Default. All void calls are ignored. When calling the fake's methods returning values or properties, they will return a fake value, which presents this behavior recursively. Any deep call will never return a Null value. + + + + + A behavior setting on how the fake object is created. + + + + + Don't execute constructor when creating a fake object + + + + + Run constructor when creating a fake object + + + + + Overloaded. Returns a fake instance of type T. Using this overload is equal to using Members.MustSpecifyReturnValues. + + The type of fake object to create. + A fake instance of type T. + Members Enum + + Here is an example how to use Instance in order to fake a RealLogger instance: + + [TestMethod] + [Isolated] + public void FakeAnInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Count = 0; + + // This call is faked because we used the default Instance overload - count should not increment + fake.Increment(); + + Assert.AreEqual(0, fake.Count); + } + + + + + + Overloaded. Returns a fake instance of type T. + + + + The type of the fake instance to be created. + + Can be one of the following values: + + + Members ValueDescription + + Members.MustSpecifyReturnValues + Default. All void calls are ignored. Unless using on methods that return values and properties, they will throw a . + + + + Members.ReturnNulls + All void calls are ignored. Unless using on methods that return values and properties, they will return Null values (or zero for value types). + + + + Members.CallOriginal + All methods are called. Using allow to change this behavior. + + + + Members.ReturnRecursiveFakes + All void calls are ignored. When calling the fake's methods returning values or properties, they will return a fake value, which presents this behavior recursively. Any deep call will never return a Null value. + + + + + A fake instance of Type T. + + + The following test shows the default behavior of Instance: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseDefault() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + + fake.Count = 0; + + // This call is faked because we used Instance's default overload - count should not increment + fake.Increment(); + Assert.AreEqual(0, fake.Count); + + // The following statement will throw, because we didn't set behavior on IntCall method. + int x = fake.IntCall(); + } + + The next test shows the CallOriginal setting on Instance: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseCallOriginal() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + fake.Count = 0; + + // This call is not faked. Count should be incremented. + fake.Increment(); + Assert.AreEqual(1, fake.Count); + } + + The next test shows what happens when using ReturnNulls: + + [TestMethod] + [Isolated] + public void FakeAnInstance_UseReturnNulls() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnNulls); + + fake.Count = 0; + // This call is faked because we set faked method behavior using ReturnNulls + fake.Increment(); + Assert.AreEqual(0, fake.Count); + + // Since we're returning Null by default the following Assert passes + Assert.IsNull(fake.IntCall()); + } + + Finally, using recursive faking, this test should pass: + + [TestMethod] + [Isolated] + public void RecursiveStubsChain() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.ReturnRecursiveFakes); + + // This method returns a value type, and therefore, returns a fake 0. + Assert.AreEqual(0, fake.ReturnFive()); + + // This method returns an object, and therefore returns a non-null object + Assert.IsNotNull(fake.GetSon()); + + // And the result of GetSon also returns a non-null object + Assert.IsNotNull(fake.GetSon().GetNephew()); + } + + + + + + Interface for specifying behavior for intercepted calls on public methods returning values. The interface is returned + by the method. + + + This interface allow tweaking the behavior of public methods that has return values. + + + + + Specify that the intercepted method will return a recursive fake. + The real implementation will not be executed. + + + + ReturnRecursiveFake() is a completing statement for . It + is similar to using the behavior setting when creating + fake objects with , but applies only to a single method. + + Use ReturnRecursiveFake() on a method to fake out calls to the method and any call chains + beginning with it. When ReturnRecursiveFake() is called on a method returning an object, + a fake object will be returned. That fake object in turn will return fake values for any + method calls. + ReturnRecursiveFake() on a method returning a value type will set the method to return + the default value of that type. + + + + + This example shows using ReturnRecursiveFake() to fake out a call chain + + [TestMethod] + [Isolated] + public void ReturnRecursiveFake_ChainedCallsAreFake() + { + // create a fake logger which will behave as the original one + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + // exclude one method from the default behavior and return a recursive fake from it + Isolate.WhenCalled(() => fake.Storage).ReturnRecursiveFake(); + + // subsequent calls to the method will not return null values + Assert.IsNotNull(fake.Storage); + Assert.IsNotNull(fake.Storage.FileSystem); + // methods returning a value type will return the default value for the type + Assert.AreEqual(0, fake.Storage.FreeSpaceInBytes); + } + + + + + + Specifies that the behavior will only be set on method calls with the exact arguments. + + + + WithExactArguments() is a completing statement for . + + + + This example shows how to use WithExactArguments() to set behavior on specific method call + + [TestMethod] + [Isolated] + public void WithExactArguments_DifferentArgsReturnDifferentValues() + { + // create a fake logger which will behave as the original one + RealLogger fake = Isolate.Fake.Instance<RealLogger>(Members.CallOriginal); + + // Set return value according to exact arguments + Isolate.WhenCalled(() => fake.IntCallWithArg(0)).WithExactArguments().WillReturn(10); + Isolate.WhenCalled(() => fake.IntCallWithArg(1)).WithExactArguments().WillReturn(20); + + // Check that the correct value returned + Assert.AreEqual(10, fake.IntCallWithArg(0)); + Assert.AreEqual(20, fake.IntCallWithArg(1)); + } + + + + + + This class used as part of the future object pattern. The pattern allows swapping of a + given instance with a mocked instance on its creation + + + + Here is an example how to use NextInstance in order to fake a future instance: + + [TestMethod] + [Isolated] + public void SwapAFutureInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + Isolate.Swap.NextInstance<RealLogger>().With(fake); + + Isolate.WhenCalled(() => fake.Increment()).IgnoreCall(); + + // This object is swapped with the fake + RealLogger logger = new RealLogger(); + + // Make sure Count is reset + logger.Count = 0; + + // This call is faked - count should not increment + logger.Increment(); + + Assert.AreEqual(0, logger.Count); + } + + + + + + + Specify the fake instance that will replace the created instance. + + the fake instance that will replace the created instance + + + + + This class used as part of the future object pattern. The pattern allows swapping of a + given instance with a mocked instance on its creation + + + + Here is an example how to use NextInstance in order to fake a future instance: + + [TestMethod] + [Isolated] + public void SwapAFutureInstance_StubIncrementMethod() + { + RealLogger fake = Isolate.Fake.Instance<RealLogger>(); + Isolate.Swap.NextInstance<RealLogger>().With(fake); + + Isolate.WhenCalled(() => fake.Increment()).IgnoreCall(); + + // This object is swapped with the fake + RealLogger logger = new RealLogger(); + + // Make sure Count is reset + logger.Count = 0; + + // This call is faked - count should not increment + logger.Increment(); + + Assert.AreEqual(0, logger.Count); + } + + + + + + diff --git a/LinqToUmbraco/dep/Reference Assemblies/Umbraco/Microsoft.ApplicationBlocks.Data.dll b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/Microsoft.ApplicationBlocks.Data.dll new file mode 100644 index 0000000000..c431985632 Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/Microsoft.ApplicationBlocks.Data.dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Umbraco/businesslogic.dll b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/businesslogic.dll new file mode 100644 index 0000000000..c1baffb93c Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/businesslogic.dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Umbraco/cms.dll b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/cms.dll new file mode 100644 index 0000000000..176594d02f Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/cms.dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Umbraco/interfaces.dll b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/interfaces.dll new file mode 100644 index 0000000000..5c1cad16f4 Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/interfaces.dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.DataLayer.dll b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.DataLayer.dll new file mode 100644 index 0000000000..8dd88a3325 Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.DataLayer.dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.dll b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.dll new file mode 100644 index 0000000000..6eb88e89cb Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.dll differ diff --git a/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.editorControls.dll b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.editorControls.dll new file mode 100644 index 0000000000..bea852fc0f Binary files /dev/null and b/LinqToUmbraco/dep/Reference Assemblies/Umbraco/umbraco.editorControls.dll differ diff --git a/LinqToUmbraco/dep/Schemas/DocTypeML.xsd b/LinqToUmbraco/dep/Schemas/DocTypeML.xsd new file mode 100644 index 0000000000..e27765e1e7 --- /dev/null +++ b/LinqToUmbraco/dep/Schemas/DocTypeML.xsd @@ -0,0 +1,83 @@ + + + + + + + + + Repesents an Umbraco Document Type and its known properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name prefix for the DataContext that will be generated + + + + + + + + Serialization mode of the generated classes + + + + + + + + + + + + + + Pairing of ID and Name + + + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/dep/Schemas/UmbracoConfig.xsd b/LinqToUmbraco/dep/Schemas/UmbracoConfig.xsd new file mode 100644 index 0000000000..f3ee8c4e84 --- /dev/null +++ b/LinqToUmbraco/dep/Schemas/UmbracoConfig.xsd @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/dep/Test Helpers/umbraco.config b/LinqToUmbraco/dep/Test Helpers/umbraco.config new file mode 100644 index 0000000000..04e050eba6 --- /dev/null +++ b/LinqToUmbraco/dep/Test Helpers/umbraco.config @@ -0,0 +1,769 @@ + + + +]> + + + + Runway gives you a bare-bones website that introduces you to a +set of well-defined conventions for building an umbraco +website.

+ +

The Runway website is very simple in form and provided without +any design or functionality. By installing Runway, you'll begin +with a minimal site built on best practices. You'll also enjoy the +benefits of speaking the same "language" as the rest of the umbraco +community by using common properties and naming conventions.

+ +

Now that you know what Runway is, it is time to get started +using Runway.

+ + + +

AJAX Loader:

+ + +]]> +
+ Runway + + + + Runway modules encapsulate specific bits of advanced functionality that are easily added to your website.

+

Once installed, Runway Modules are open source and easy to customize if you want to modify the behavior for your specific needs.
Because Runway modules are provided under the MIT license you are free to use and modify them any way you want, with no strings attached.

+

To add Runway modules to your website, go to the Developer section, expand the Packages item and click Install Runway modules.

+

Runwau modules are available for various kinds of navigation, a sitemap, and a contact form. The list of available Runway modules is growing rapidly and is automatically updated from a central source, always fresh and current.

+

Get more information about the umbraco way.

]]> +
+ 0 +
+ + + Runway only scratches the surface of what’s possible with umbraco. Below Runway and its modules lies a great architecture that lets you implement whatever you need.

+

With umbraco you’ve finally got a solid, open and reliable platform for websites as simple as a Runway site, and umbraco can be rapidly expanded to support multi-language websites, collaboration platforms and intra/extranets, to name just a few.

+

Advanced functionality is created with umbraco macros, built with XSLT and umbraco’s award-winning .NET integration, including full support for any .NET User or Custom control. Create and integrate your own .NET macros in mere minutes with point and click simplicity. Simply copy your controls to the umbraco website, go to the Developer section and create a new macro, selecting your control from the list.

+

We’ve also gathered the best community macros into a repository that’s also accessed from the Developer section, in the Packages area. You can find more information about creating macros, on the umbraco website.

+

The sky is the limit with umbraco, and you have the benefit a friendly community, training, and guaranteed support. Find out how to get help.

]]> +
+ 0 +
+ + + You’ve installed umbraco and a minimal Runway website.

+

Edit the text on the homepage and create a site structure by adding new texpages to your site. This is all done in the Content section.

+

If you find the editing options provided by Runway too limited for you needs, simply add more properties to the page by going to the Settings section, expanding the Document Types item and adding new properties on the Generic Properties tab. You can find more information about document types and properties at the umbraco website.

+

But mostly you’ll probably want to personalize your site by changing the current design. This is also done in the Settings section, by editing the CSS styles and HTML templates. Umbraco uses master templates, so the main, common markup is placed in the Runway Master template, while the Homeage and Textpage have separate templates for their unique layouts. You can find more information about templates and css in umbraco at the umbraco website.

+

Once you’re happy with your site’s design, you might want to add more functionality, such as automated navigation. This is done by installing Runway modules.

]]> +
+ 0 +
+
+ + + Aaron + Powell + + + Bart + Simpson + + + Homer + Simpson + + + Lisa + Simpson + + + + + + + + + + 0 + 0 + Your logo/name + + Sam Grady designed this for Warren +Buckley. "This" idea was first created by the incredible +Robert Brownjohn and has been copied many times since.

+]]> +
+ /media/49/home_photo.jpg + + Thank you for installing the umbraco website package created and +developed by Warren Buckley. This website package should be used to +help you understand how all the components of an Umbraco site +works.

+]]> +
+ + + + + + + + 0 + 0 + + This is a good place to put a service message or something to +help define your site or company.

+]]> +
+ + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. +Aliquam ullamcorper condimentum lorem. Curabitur placerat nunc ut +leo. Integer eros ligula, vestibulum at, eleifend id, dignissim +vel, est.

+ +

Fusce tristique. Cras faucibus porta nunc. Aliquam ultrices, +arcu quis ornare sagittis, lectus augue ornare nulla, eu lobortis +velit lectus id nibh. Aliquam condimentum aliquet purus. Quisque +blandit ante non sapien. Sed justo libero, sollicitudin ac, pretium +et, luctus nec, nisl. Nulla semper neque nec magna. Cras ut nibh ut +urna bibendum sodales. Quisque venenatis euismod lacus. +Pellentesque dapibus turpis at urna.

+ +

Sub Header

+ +

Sed scelerisque adipiscing mauris. Mauris egestas dapibus quam. +Integer in libero eget eros dignissim pretium. Proin luctus sem nec +lorem. Praesent lorem. Vivamus eget nunc quis sapien condimentum +egestas. Maecenas facilisis, nunc at sodales facilisis, quam magna +pretium nibh, vel ultrices lectus lorem quis neque. Nam sit amet +leo ac lectus gravida convallis. Phasellus at enim vel dui porta +porttitor. Morbi id dolor adipiscing erat egestas consequat.

+ +

Phasellus diam. Morbi +dolor. Donec consequat sodales nunc. Nam dapibus lectus id +lectus. Sed ultrices metus sit amet est. Morbi porttitor. Proin vel +risus. Phasellus sodales convallis justo. Sed luctus hendrerit +risus. Sed est lorem, feugiat et, rutrum quis, condimentum non, +nunc. Aenean urna leo, sagittis a, commodo eget, lobortis nec, +eros. Vivamus pharetra, lectus eu ultrices pulvinar, nunc quam +consectetur nibh, sed pulvinar leo dolor ut felis.

+ +
    +
  1. Item one
  2. + +
  3. Item two
  4. + +
  5. Item three
  6. +
+ +

Nullam lobortis, mi nec feugiat congue, dolor diam cursus lacus, +a elementum ligula dolor vitae sem. Suspendisse at quam. Praesent +neque. Vestibulum at justo. Nulla rutrum velit et eros.

+ +
    +
  • Integer convallis augue in tellus
  • + +
  • Magna quam sollicitudin mauris
  • +
+ +

Nullam lobortis, mi nec feugiat congue, dolor diam cursus lacus, +a elementum ligula dolor vitae sem. Suspendisse at quam.

+]]> +
+ + + + + + + + 0 + 0 + + It's the KING of all CMS's, what more do you +need to know about it?

+]]> +
+ /media/171/umbraco_tshirt.jpg + + Umbraco CMS is free + +

It means that you are not bound and locked to the licensing +rules about the number of content items / processors / web / +domains, etc. Many products are very expensive as the license cost +escalates with the number of websites. In many cases, one is soon +up in the 500' before one can even start to implement the +solution.

+ +

Umbraco is Open Source

+ +

In an Open Source product one has at any time full access to +source code. This provides insight and leads to better quality, as +"shortcuts" and bad code can easily be penetrated. Moreover, one +has the ability to influence and further develop the product.

+ +

Umbraco is based on open source and is therefore not +lisence-plated or subject to an enterprise's ownership. The Umbraco +publishing tool places great emphasis on simplicity, standards, +flexibility and integration. Umbraco was launched in 2005 and has +had a tremendous growth since that time. Umbraco is today among the +most popular systems based on open source for Microsoft. NET +platform.

+ +

100% Microsoft .NET

+ +

Umbraco is built 100% on the Microsoft. NET 2.0. This means that +you can use 3rd party .NET components directly in Umbraco. +Moreover, integration with other .NET-based solutions is well +adapted from Umbracos part. Umbraco won an award for the +Integration possibilities on BNP Awards 2006.

+ +

Fast results

+ +

Umbraco is a powerful tool with a focus on core functionality +and openness. This efficiently allows you to achieve exactly what +you want - rather than be restricted to a "finished" module, which +makes only half of what you really wanted.

+ +

Easy-to-use

+ +

Umbraco has a focus on content and facilitate rapid and +intuitive content management. The system strives to be elegant, +usable and effective.

+ +

Based on standards

+ +

Umbraco is based on standards from the W3C as XHTML, CSS, XML +and XSLT. This gives a greater flexibility and independence, which +in turn provides more value for the money.

+ +

Integration

+ +

Umbraco is known to be among the best CMS on integration. Much +of the reason for this is the way to expose Microsoft ASP.NET +components as elements of, or so-called "macro's" for use in +templates, as well as in the WYSIWYG editor that writers and +editors use. Elements is also possible to "cache" on several levels +and is based on standard Microsoft .NET technology. Below are some +examples:

+ +
    +
  • External XML sources (ex RSS) can be directly implemented via +XSLT elements (macros).
  • + +
  • ASP.NET controls that retrieve data from external or internal +posterior systems via standard Web Services.
  • +
+ +

 

+ +

 

+]]> +
+
+ + /media/227/warren-buckley.jpg + /media/228/sam-grady.jpg + + Sam Grady + +

Sam Grady, me, is a graphic designer. I loves graphic design. +Great graphic design and simple solutions makes this man very +happy. Photography is also very close to my heart and I'd like to +be better, so I practice a lot and annoy people with my +requests.
+
+ I haven't got a blog, yet, don't Twitter and cancelled my Facebook +account as I felt uncomfortable with people knowing my business. +Anyone else feel that way? I do, however, have a Flickr account, so +go check it out: www.flickr.com/photos/mrgrady
+
+ I also have my own business, G72, which has a website that +desperately needs updating. Also, as of today (03/03/09), it's +currently down due to inept web hosts. Hopefully it won't be if you +want to take a look: www.g-72.co.uk
+
+ Regarding this project, Warren asked me if I wanted to design his +website starter package for the fantastic Umbraco CMS, which I +jumped at the chance to do. Hopefully you'll find the design +appropriate and the package very useful, as that's what we really +want from this project.
+
+ Finally, Warren says the layout is work in progress and I have a, +typically fussy, list of designer layout requests that I've asked +Warren to do, but time being what it is, these changes won't be +made on version 2.0, so if you spot anything, do mail the man as +we'll be compiling a list of tweaks to be made.
+
+ Enjoy.

+]]> +
+ + Warren Buckley + +

Warren Buckley is a web developer who specialises in using the +Umbraco CMS platform to build content managed websites for Xeed in +Norway. I run a blog called Creative Web +Specialist, where I mainly write tips and tutorial articles +around Umbraco.

+ +

I have teamed up with ex-collegue Sam Grady to help me design +the new version of CWS as he produces wonderfully sexy designs for +the web. If you have seen my previous version/s of CWS you will +know that my design skills are far from stunning.

+ +

I decided to create this website starter site nicknamed CWS +(Creative Website Starter site) as a learning tool to help you +understand how all the elements of a site work together in +Umbraco.

+ +

From this NEW CWS package comes the +following:

+ +
    +
  • Obviously a BRAND NEW spanking design from +ex-collegue Sam Grady of G-72
  • + +
  • A focus for this site to be used to help teach new users to the +Umbraco CMS platform.
  • + +
  • .NET usercontrols written in C#
  • + +
  • XSLT & .NET code heavily commented to help understand what +is going on.
  • + +
  • With supporting documentation coming in the near future.
  • +
+ +

Want to see where else you can find me on the net?
+ Blog - www.creativewebspecialist.co.uk
+ Flickr - www.flickr.com/photos/warrenbuckley
+ Last.FM - www.last.fm/user/warrenbuckley
+ Twitter - twitter.com/warrenbuckley

+]]> +
+ + + + + + + 0 + 0 + + This website has been produced to help you understand +Umbraco.

+]]> +
+
+
+ + + + + + + + 0 + 0 + + This first page displays all the albums featured within your +site.
+ Please have a browse through.

+]]> +
+ + + + + + + + + + 0 + 0 + + The Bookhouse Boys. Live at the ICA, London.

+]]> +
+ + + /media/1239/bookhouse-boys_gallery.jpg + + Credit: Sam Grady + /media/1277/bookhouse-boys_3.jpg + /media/1314/bookhouse-boys_3_thumb.jpg + + + + + + + 0 + 0 + + + Credit: Sam Grady + /media/1250/bookhouse-boys_1.jpg + /media/1296/bookhouse-boys_1_thumb.jpg + + + + + + + 0 + 0 + + + Credit: Sam Grady + /media/1331/bookhouse-boys_2.jpg + /media/1350/bookhouse-boys_2_thumb.jpg + + + + + + + 0 + 0 + +
+ + + + + + + + 0 + 0 + + Where all the great minds of umbraco meet!

+]]> +
+ + + /media/993/codegarden-08_gallery.jpg + + Credit: Douglas Robar + /media/825/darren-ferguson_david-conlisk.jpg + /media/835/darren-ferguson_david-conlisk_thumb.jpg + + + + + + + 0 + 0 + + + Credit: Warren Buckley + /media/394/codegarden08-t-shirt.jpg + /media/799/codegarden08-t-shirt_thumb.jpg + + + + + + + 0 + 0 + + + Credit: Douglas Robar + /media/852/bingo-callers.jpg + /media/871/bingo-callers_thumb.jpg + + + + + + + 0 + 0 + + + Credit: Douglas Robar + /media/879/christian-palm.jpg + /media/889/christian-palm_thumb.jpg + + + + + + + 0 + 0 + +
+ + + + + + + + 0 + 0 + + Photos from a trip to Bath in November 2008

+]]> +
+ + + /media/935/bath_gallery.jpg + + Credit: Warren Buckley + /media/995/royal-crescent.jpg + /media/1014/royal-crescent_thumb.jpg + + + + + + + 0 + 0 + +
+
+ + + + + + + + 0 + 0 + + + + Please browse through our news archive and event listings +below.

+]]> +
+ + 2009-06-22T00:00:00 + + Come join the annual umbraco developer conference in Wonderful +Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers, +great conversations and friendly people. + +

The who's who of umbraco will be gathered and share their +knowledge through talks, tutorials and via un-conference formats +like open space or hacking sessions. We have booked a cool, old and +huge industrial venue in central Copenhagen where we'll have one +huge room, three rooms for breakout sessions and a Café that +serves your taste of espresso.

+ +

Come join the annual umbraco developer conference in Wonderful +Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers, +great conversations and friendly people.

+ +

We've planned a program that fits both experienced umbraco users +as well as new comers. The conference is kicked off with a Keynote +and after that we'll have two or three tracks of sessions and the +first day is rounded with an open Q/A session with the umbraco core +team.

+ +

The second day features an un-conference format called open +space, which we also used with great success at last year's +conference. It's a format where everybody can suggest a topic and +as we have plenty of break-out rooms rest assured that there'll be +room for your topic as well. Last year's more than 20 topics +covered Silverlight, High performance websites with umbraco, +building custom data types and much more.

+ +

But it doesn't ends there. We've ensured that we can stay at the +venue until midnight both days which means that when the first day +ends, the fun begins. With more than hundred people gathered at a +place with loads of umbraco knowledge, wifi, great food and plenty +of space, who knows what could happen. A BBQ, new packages, +improvised demos and talks, or...?

+ +

 

+]]> +
+ /media/445/umbraco_tshirt.jpg + + + + + + + 0 + 0 +
+ + + After Warren Buckley's success of the first Creative Website +Starter site package, with over 20K downloads he has decided to +work on CWS2. + +

As of today Wednesday the 4th March 2009, the CWS2 package is +now available to download from the built in package repository +inside Umbraco.

+ +

With this new version comes the following:

+ +
    +
  • A BRAND NEW spanking design from ex-collegue +Sam Grady of G-72
  • + +
  • A focus for this site to be used to help teach new users to the +Umbraco CMS platform.
  • + +
  • .NET usercontrols written in C#
  • + +
  • XSLT & .NET code heavily commented to help understand what +is going on.
  • + +
  • With supporting documentation coming in the near future.
  • +
+]]> +
+ + + + + + + + + 0 + 0 +
+
+ + you@yourcompany.co.uk + Email from Contact form on website + + + + you@yourcompany.co.uk + Thank you for your message + + + + 0 + + + + + + + 0 + 0 + + Everything you need to
+ get in touch.

+]]> +
+ + Enquiry Form + +

If you have a particular enquiry, please fill out the form below +and provide as much information as you can, so that one of our +representatives can deal with your enquiry as effciently as +possible.

+]]> +
+ + Thank you. We will be in touch shortly.

+]]> +
+ + Thanks for filling out our contact form we will get back to you +shortly.

+ +

Regards,
+ My Company

+]]> +
+
+ + you@yourcompany.co.uk + [YourName] has sent you a link to read + + + + 0 + + + + + + + 0 + 1 + + Send a page onto your friend.

+]]> +
+ + Thank you. We appreciate the love you are +giving our site.

+]]> +
+ + Thanks for sending that link onto your friend, we really +appreciate it here at My Company.

+]]> +
+
+
+
\ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj new file mode 100644 index 0000000000..9e06840049 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj @@ -0,0 +1,83 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {324A7FA9-8F19-4D4D-B96A-6F673C82BC92} + Library + Properties + umbraco.LinqCore.Mockable.Tests + umbraco.LinqCore.Mockable.Tests + v3.5 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\Debug - Fixed Version\ + DEBUG;TRACE + full + AnyCPU + true + GlobalSuppressions.cs + prompt + + + + + False + ..\..\..\dep\Reference Assemblies\Mocking\Rhino.Mocks.dll + + + + 3.5 + + + 3.0 + + + + + Properties\SolutionInfo.cs + + + + + + + + {31CAEC36-0C3D-4D69-B092-84866811EA07} + Core + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj.user b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj.user new file mode 100644 index 0000000000..5c2d6e6a78 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj.user @@ -0,0 +1,5 @@ + + + ShowAllFiles + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj.vspscc b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Core.Mockable.Tests.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/DataContextMockTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/DataContextMockTest.cs new file mode 100644 index 0000000000..7505a29b5f --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/DataContextMockTest.cs @@ -0,0 +1,84 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Rhino.Mocks; +using umbraco.Linq.Core; +using umbraco.Test; + +namespace umbraco.LinqCore.Mockable.Tests +{ + /// + /// Summary description for DataContextMockTest + /// + [TestClass] + public class DataContextMockTest + { + public DataContextMockTest() + { + + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod] + public void DataContextMockTest_MockProvider() + { + var dataProvider = MockRepository.GenerateMock(); + using (var ctx = new MyumbracoDataContext(dataProvider)) + { + } + } + + [TestMethod, ExpectedException(typeof(NotImplementedException))] + public void DataContextMockTest_MockProviderThrowsException() + { + var dataProvider = MockRepository.GenerateMock(); + + dataProvider.Stub(d => d.LoadTree()).Throw(new NotImplementedException()); + using (var ctx = new MyumbracoDataContext(dataProvider)) + { + var homes = ctx.CwsHomes; + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/MyUmbraco.designer.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/MyUmbraco.designer.cs new file mode 100644 index 0000000000..5da73a8469 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/MyUmbraco.designer.cs @@ -0,0 +1,3868 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3074 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace umbraco.Test +{ + using umbraco.Linq.Core; + using umbraco.Linq.Core.Node; + using System.Linq; + + + public partial class MyumbracoDataContext : umbracoDataContext + { + + #region Partials + partial void OnCreated(); + #endregion + + + public MyumbracoDataContext() : + base() + { + OnCreated(); + } + + public MyumbracoDataContext(umbracoDataProvider provider) : + base(provider) + { + OnCreated(); + } + + public Tree Runwayhomepages + { + get + { + return this.LoadTree(); + } + } + + public Tree Runwaytextpages + { + get + { + return this.LoadTree(); + } + } + + public Tree ContentFolders + { + get + { + return this.LoadTree(); + } + } + + public Tree Persons + { + get + { + return this.LoadTree(); + } + } + + public Tree InheritedFolders + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsContacts + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsEmailafriends + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsEventitems + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsGallerylists + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsGalleries + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsHomes + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsNewseventslists + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsNewsitems + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsPhotos + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsTextpages + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsTextpagetwocols + { + get + { + return this.LoadTree(); + } + } + + public Tree TextpageThreeCols + { + get + { + return this.LoadTree(); + } + } + } + + /// + /// The homepage of a Runway website. + /// + [UmbracoInfo("RunwayHomepage", Id = 1045)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class Runwayhomepage : DocTypeBase + { + + private string _Bodytext; + + private string _Sitename; + + private string _Sitedescription; + + private AssociationTree _Runwaytextpages; + + public Runwayhomepage() + { + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Body text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("siteName", DisplayName = "Site Name", Mandatory = false)] + [Property()] + public virtual string Sitename + { + get + { + return this._Sitename; + } + set + { + if ((this._Sitename != value)) + { + this.RaisePropertyChanging(); + this._Sitename = value; + this.RaisePropertyChanged("Sitename"); + } + } + } + + /// + /// + /// + [UmbracoInfo("siteDescription", DisplayName = "Site Description", Mandatory = false)] + [Property()] + public virtual string Sitedescription + { + get + { + return this._Sitedescription; + } + set + { + if ((this._Sitedescription != value)) + { + this.RaisePropertyChanging(); + this._Sitedescription = value; + this.RaisePropertyChanged("Sitedescription"); + } + } + } + + public AssociationTree Runwaytextpages + { + get + { + if ((this._Runwaytextpages == null)) + { + this._Runwaytextpages = this.ChildrenOfType(); + } + return this._Runwaytextpages; + } + set + { + this._Runwaytextpages = value; + } + } + } + + /// + /// Runway textpage; this is the standard content page for a Runway website. + /// + [UmbracoInfo("RunwayTextpage", Id = 1046)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class Runwaytextpage : DocTypeBase + { + + private string _Bodytext; + + private int _umbraconavihide; + + private AssociationTree _Runwaytextpages; + + public Runwaytextpage() + { + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Body Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in navigation", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + public AssociationTree Runwaytextpages + { + get + { + if ((this._Runwaytextpages == null)) + { + this._Runwaytextpages = this.ChildrenOfType(); + } + return this._Runwaytextpages; + } + set + { + this._Runwaytextpages = value; + } + } + } + + /// + /// + /// + [UmbracoInfo("Content Folder", Id = 1052)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class ContentFolder : DocTypeBase + { + + private AssociationTree _Persons; + + public ContentFolder() + { + } + + public AssociationTree Persons + { + get + { + if ((this._Persons == null)) + { + this._Persons = this.ChildrenOfType(); + } + return this._Persons; + } + set + { + this._Persons = value; + } + } + } + + /// + /// + /// + [UmbracoInfo("Person", Id = 1053)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class Person : DocTypeBase + { + + private string _Firstname; + + private string _Lastname; + + public Person() + { + } + + /// + /// + /// + [UmbracoInfo("FirstName", DisplayName = "First Name", Mandatory = false)] + [Property()] + public virtual string Firstname + { + get + { + return this._Firstname; + } + set + { + if ((this._Firstname != value)) + { + this.RaisePropertyChanging(); + this._Firstname = value; + this.RaisePropertyChanged("Firstname"); + } + } + } + + /// + /// + /// + [UmbracoInfo("LastName", DisplayName = "Last Name", Mandatory = false)] + [Property()] + public virtual string Lastname + { + get + { + return this._Lastname; + } + set + { + if ((this._Lastname != value)) + { + this.RaisePropertyChanging(); + this._Lastname = value; + this.RaisePropertyChanged("Lastname"); + } + } + } + } + + /// + /// + /// + [UmbracoInfo("Inherited Folder", Id = 1059)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class InheritedFolder : ContentFolder + { + + public InheritedFolder() + { + } + } + + /// + /// This is the contact form document type for your site. + /// + [UmbracoInfo("CWS_Contact", Id = 1079)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsContact : DocTypeBase + { + + private string _Emailto; + + private string _Emailsubject; + + private string _Emailbody; + + private string _Emailreplyfrom; + + private string _Emailreplysubject; + + private string _Emailreplybody; + + private int _Enablessl; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Formtext; + + private string _Thankyouheadertext; + + private string _Thankyoumessagetext; + + private AssociationTree _CwsTextpages; + + public CwsContact() + { + } + + /// + /// The email address that you want the form to be sent to. + /// + [UmbracoInfo("emailTo", DisplayName = "Email To", Mandatory = true)] + [Property()] + public virtual string Emailto + { + get + { + return this._Emailto; + } + set + { + if ((this._Emailto != value)) + { + this.RaisePropertyChanging(); + this._Emailto = value; + this.RaisePropertyChanged("Emailto"); + } + } + } + + /// + /// The subject of the email that will be sent to you. + /// + [UmbracoInfo("emailSubject", DisplayName = "Email Subject", Mandatory = true)] + [Property()] + public virtual string Emailsubject + { + get + { + return this._Emailsubject; + } + set + { + if ((this._Emailsubject != value)) + { + this.RaisePropertyChanging(); + this._Emailsubject = value; + this.RaisePropertyChanged("Emailsubject"); + } + } + } + + /// + /// Use placeholders [Name], [AddressLine1], [AddressLine2], [Email], [Message], [Time] and [Date] + /// + [UmbracoInfo("emailBody", DisplayName = "Email Message", Mandatory = true)] + [Property()] + public virtual string Emailbody + { + get + { + return this._Emailbody; + } + set + { + if ((this._Emailbody != value)) + { + this.RaisePropertyChanging(); + this._Emailbody = value; + this.RaisePropertyChanged("Emailbody"); + } + } + } + + /// + /// The email address that you want the automated reply to be sent from. + /// + [UmbracoInfo("emailReplyFrom", DisplayName = "Email Reply From", Mandatory = true)] + [Property()] + public virtual string Emailreplyfrom + { + get + { + return this._Emailreplyfrom; + } + set + { + if ((this._Emailreplyfrom != value)) + { + this.RaisePropertyChanging(); + this._Emailreplyfrom = value; + this.RaisePropertyChanged("Emailreplyfrom"); + } + } + } + + /// + /// The subject of the email that will be sent as the automated reply. + /// + /// + [UmbracoInfo("emailReplySubject", DisplayName = "Email Reply Subject", Mandatory = false)] + [Property()] + public virtual string Emailreplysubject + { + get + { + return this._Emailreplysubject; + } + set + { + if ((this._Emailreplysubject != value)) + { + this.RaisePropertyChanging(); + this._Emailreplysubject = value; + this.RaisePropertyChanged("Emailreplysubject"); + } + } + } + + /// + /// Use placeholder [Name] + /// + [UmbracoInfo("emailReplyBody", DisplayName = "Email Reply Body", Mandatory = false)] + [Property()] + public virtual string Emailreplybody + { + get + { + return this._Emailreplybody; + } + set + { + if ((this._Emailreplybody != value)) + { + this.RaisePropertyChanging(); + this._Emailreplybody = value; + this.RaisePropertyChanged("Emailreplybody"); + } + } + } + + /// + /// Does your SMTP server require SSL? + /// + [UmbracoInfo("enableSSL", DisplayName = "Enable SSL", Mandatory = false)] + [Property()] + public virtual int Enablessl + { + get + { + return this._Enablessl; + } + set + { + if ((this._Enablessl != value)) + { + this.RaisePropertyChanging(); + this._Enablessl = value; + this.RaisePropertyChanged("Enablessl"); + } + } + } + + private bool EnablesslBoolean + { + get + { + return (this._Enablessl == 0); + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// This is the text that sits to the left of the contact form. + /// + [UmbracoInfo("formText", DisplayName = "Form Text", Mandatory = false)] + [Property()] + public virtual string Formtext + { + get + { + return this._Formtext; + } + set + { + if ((this._Formtext != value)) + { + this.RaisePropertyChanging(); + this._Formtext = value; + this.RaisePropertyChanged("Formtext"); + } + } + } + + /// + /// This is the header for the thankyou the user will see after sumbitting the contact form. + /// + [UmbracoInfo("thankYouHeaderText", DisplayName = "Thank You Header", Mandatory = true)] + [Property()] + public virtual string Thankyouheadertext + { + get + { + return this._Thankyouheadertext; + } + set + { + if ((this._Thankyouheadertext != value)) + { + this.RaisePropertyChanging(); + this._Thankyouheadertext = value; + this.RaisePropertyChanged("Thankyouheadertext"); + } + } + } + + /// + /// This is the thankyou message that the user will see after submitting your form. + /// + [UmbracoInfo("thankYouMessageText", DisplayName = "Thank You Message", Mandatory = true)] + [Property()] + public virtual string Thankyoumessagetext + { + get + { + return this._Thankyoumessagetext; + } + set + { + if ((this._Thankyoumessagetext != value)) + { + this.RaisePropertyChanging(); + this._Thankyoumessagetext = value; + this.RaisePropertyChanged("Thankyoumessagetext"); + } + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + } + + /// + /// This is the email a friend form document type for your site. + /// + [UmbracoInfo("CWS_EmailAFriend", Id = 1080)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsEmailafriend : DocTypeBase + { + + private string _Emailfrom; + + private string _Emailsubjecttofriend; + + private string _Emailmessagetofriend; + + private int _Enablessl; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Thankyouheadertext; + + private string _Thankyoumessagetext; + + private AssociationTree _CwsTextpages; + + public CwsEmailafriend() + { + } + + /// + /// The email address that you want the email to be sent from. + /// + [UmbracoInfo("emailFrom", DisplayName = "Email From", Mandatory = true)] + [Property()] + public virtual string Emailfrom + { + get + { + return this._Emailfrom; + } + set + { + if ((this._Emailfrom != value)) + { + this.RaisePropertyChanging(); + this._Emailfrom = value; + this.RaisePropertyChanged("Emailfrom"); + } + } + } + + /// + /// The subject of the email that will be sent to the friend. + /// + [UmbracoInfo("emailSubjectToFriend", DisplayName = "Email Subject to Friend", Mandatory = true)] + [Property()] + public virtual string Emailsubjecttofriend + { + get + { + return this._Emailsubjecttofriend; + } + set + { + if ((this._Emailsubjecttofriend != value)) + { + this.RaisePropertyChanging(); + this._Emailsubjecttofriend = value; + this.RaisePropertyChanged("Emailsubjecttofriend"); + } + } + } + + /// + /// Use placeholders [FriendName], [FriendEmail], [YourName], [YourEmail], [Message], [Date], [Time], [URL] + /// + [UmbracoInfo("emailMessageToFriend", DisplayName = "Email Message to Friend", Mandatory = true)] + [Property()] + public virtual string Emailmessagetofriend + { + get + { + return this._Emailmessagetofriend; + } + set + { + if ((this._Emailmessagetofriend != value)) + { + this.RaisePropertyChanging(); + this._Emailmessagetofriend = value; + this.RaisePropertyChanged("Emailmessagetofriend"); + } + } + } + + /// + /// Does your SMTP server require SSL? + /// + [UmbracoInfo("enableSSL", DisplayName = "Enable SSL", Mandatory = false)] + [Property()] + public virtual int Enablessl + { + get + { + return this._Enablessl; + } + set + { + if ((this._Enablessl != value)) + { + this.RaisePropertyChanging(); + this._Enablessl = value; + this.RaisePropertyChanged("Enablessl"); + } + } + } + + private bool EnablesslBoolean + { + get + { + return (this._Enablessl == 0); + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// This is the header for the thankyou the user will see after sumbitting the contact form. + /// + [UmbracoInfo("thankYouHeaderText", DisplayName = "Thank You Header", Mandatory = true)] + [Property()] + public virtual string Thankyouheadertext + { + get + { + return this._Thankyouheadertext; + } + set + { + if ((this._Thankyouheadertext != value)) + { + this.RaisePropertyChanging(); + this._Thankyouheadertext = value; + this.RaisePropertyChanged("Thankyouheadertext"); + } + } + } + + /// + /// This is the thankyou message that the user will see after submitting your form. + /// + [UmbracoInfo("thankYouMessageText", DisplayName = "Thank You Text", Mandatory = true)] + [Property()] + public virtual string Thankyoumessagetext + { + get + { + return this._Thankyoumessagetext; + } + set + { + if ((this._Thankyoumessagetext != value)) + { + this.RaisePropertyChanging(); + this._Thankyoumessagetext = value; + this.RaisePropertyChanged("Thankyoumessagetext"); + } + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + } + + /// + /// This is the event document type for your site and lives beneath the News & Events List document type. + /// + [UmbracoInfo("CWS_EventItem", Id = 1081)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsEventitem : DocTypeBase + { + + private System.DateTime _Eventdate; + + private string _Bodytext; + + private string _Articlephoto; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + public CwsEventitem() + { + } + + /// + /// + /// + [UmbracoInfo("eventDate", DisplayName = "Date", Mandatory = false)] + [Property()] + public virtual System.DateTime Eventdate + { + get + { + return this._Eventdate; + } + set + { + if ((this._Eventdate != value)) + { + this.RaisePropertyChanging(); + this._Eventdate = value; + this.RaisePropertyChanged("Eventdate"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("articlePhoto", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephoto + { + get + { + return this._Articlephoto; + } + set + { + if ((this._Articlephoto != value)) + { + this.RaisePropertyChanging(); + this._Articlephoto = value; + this.RaisePropertyChanged("Articlephoto"); + } + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + } + + /// + /// This is the Galleries document type for your site which stores the Gallery document type as children. + /// + [UmbracoInfo("CWS_GalleryList", Id = 1082)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsGallerylist : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Sortby; + + private string _Sortorder; + + private AssociationTree _CwsGalleries; + + public CwsGallerylist() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortBy", DisplayName = "Sort By", Mandatory = true)] + [Property()] + public virtual string Sortby + { + get + { + return this._Sortby; + } + set + { + if ((this._Sortby != value)) + { + this.RaisePropertyChanging(); + this._Sortby = value; + this.RaisePropertyChanged("Sortby"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortOrder", DisplayName = "Sort Order", Mandatory = true)] + [Property()] + public virtual string Sortorder + { + get + { + return this._Sortorder; + } + set + { + if ((this._Sortorder != value)) + { + this.RaisePropertyChanging(); + this._Sortorder = value; + this.RaisePropertyChanged("Sortorder"); + } + } + } + + public AssociationTree CwsGalleries + { + get + { + if ((this._CwsGalleries == null)) + { + this._CwsGalleries = this.ChildrenOfType(); + } + return this._CwsGalleries; + } + set + { + this._CwsGalleries = value; + } + } + } + + /// + /// This is the gallery document type which stores the Photo document type as children. + /// + [UmbracoInfo("CWS_Gallery", Id = 1083)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsGallery : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Sortby; + + private string _Sortorder; + + private string _Gallerythumbnail; + + private AssociationTree _CwsPhotos; + + public CwsGallery() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortBy", DisplayName = "Sort By", Mandatory = true)] + [Property()] + public virtual string Sortby + { + get + { + return this._Sortby; + } + set + { + if ((this._Sortby != value)) + { + this.RaisePropertyChanging(); + this._Sortby = value; + this.RaisePropertyChanged("Sortby"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortOrder", DisplayName = "Sort Order", Mandatory = true)] + [Property()] + public virtual string Sortorder + { + get + { + return this._Sortorder; + } + set + { + if ((this._Sortorder != value)) + { + this.RaisePropertyChanging(); + this._Sortorder = value; + this.RaisePropertyChanged("Sortorder"); + } + } + } + + /// + /// 208px x 108px + /// + [UmbracoInfo("galleryThumbnail", DisplayName = "Thumbnail for Gallery", Mandatory = false)] + [Property()] + public virtual string Gallerythumbnail + { + get + { + return this._Gallerythumbnail; + } + set + { + if ((this._Gallerythumbnail != value)) + { + this.RaisePropertyChanging(); + this._Gallerythumbnail = value; + this.RaisePropertyChanged("Gallerythumbnail"); + } + } + } + + public AssociationTree CwsPhotos + { + get + { + if ((this._CwsPhotos == null)) + { + this._CwsPhotos = this.ChildrenOfType(); + } + return this._CwsPhotos; + } + set + { + this._CwsPhotos = value; + } + } + } + + /// + /// This is the homepage document type for your site. + /// + [UmbracoInfo("CWS_Home", Id = 1084)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsHome : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Sitename; + + private string _Headertext; + + private string _Homepagephoto; + + private string _Bodytext; + + private AssociationTree _CwsContacts; + + private AssociationTree _CwsEmailafriends; + + private AssociationTree _CwsGallerylists; + + private AssociationTree _CwsNewseventslists; + + private AssociationTree _CwsTextpages; + + private AssociationTree _CwsTextpagetwocols; + + public CwsHome() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// This is what your site is called. + /// + [UmbracoInfo("siteName", DisplayName = "Site Name", Mandatory = false)] + [Property()] + public virtual string Sitename + { + get + { + return this._Sitename; + } + set + { + if ((this._Sitename != value)) + { + this.RaisePropertyChanging(); + this._Sitename = value; + this.RaisePropertyChanged("Sitename"); + } + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("homepagePhoto", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Homepagephoto + { + get + { + return this._Homepagephoto; + } + set + { + if ((this._Homepagephoto != value)) + { + this.RaisePropertyChanging(); + this._Homepagephoto = value; + this.RaisePropertyChanged("Homepagephoto"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + public AssociationTree CwsContacts + { + get + { + if ((this._CwsContacts == null)) + { + this._CwsContacts = this.ChildrenOfType(); + } + return this._CwsContacts; + } + set + { + this._CwsContacts = value; + } + } + + public AssociationTree CwsEmailafriends + { + get + { + if ((this._CwsEmailafriends == null)) + { + this._CwsEmailafriends = this.ChildrenOfType(); + } + return this._CwsEmailafriends; + } + set + { + this._CwsEmailafriends = value; + } + } + + public AssociationTree CwsGallerylists + { + get + { + if ((this._CwsGallerylists == null)) + { + this._CwsGallerylists = this.ChildrenOfType(); + } + return this._CwsGallerylists; + } + set + { + this._CwsGallerylists = value; + } + } + + public AssociationTree CwsNewseventslists + { + get + { + if ((this._CwsNewseventslists == null)) + { + this._CwsNewseventslists = this.ChildrenOfType(); + } + return this._CwsNewseventslists; + } + set + { + this._CwsNewseventslists = value; + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + + public AssociationTree CwsTextpagetwocols + { + get + { + if ((this._CwsTextpagetwocols == null)) + { + this._CwsTextpagetwocols = this.ChildrenOfType(); + } + return this._CwsTextpagetwocols; + } + set + { + this._CwsTextpagetwocols = value; + } + } + } + + /// + /// This is the News & Events List document type for your site which stores the News and Event Item document types as children. + /// + [UmbracoInfo("CWS_NewsEventsList", Id = 1085)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsNewseventslist : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Sortby; + + private string _Sortorder; + + private string _Headertext; + + private AssociationTree _CwsEventitems; + + private AssociationTree _CwsNewsitems; + + public CwsNewseventslist() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortBy", DisplayName = "Sort By", Mandatory = true)] + [Property()] + public virtual string Sortby + { + get + { + return this._Sortby; + } + set + { + if ((this._Sortby != value)) + { + this.RaisePropertyChanging(); + this._Sortby = value; + this.RaisePropertyChanged("Sortby"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortOrder", DisplayName = "Sort Order", Mandatory = true)] + [Property()] + public virtual string Sortorder + { + get + { + return this._Sortorder; + } + set + { + if ((this._Sortorder != value)) + { + this.RaisePropertyChanging(); + this._Sortorder = value; + this.RaisePropertyChanged("Sortorder"); + } + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + public AssociationTree CwsEventitems + { + get + { + if ((this._CwsEventitems == null)) + { + this._CwsEventitems = this.ChildrenOfType(); + } + return this._CwsEventitems; + } + set + { + this._CwsEventitems = value; + } + } + + public AssociationTree CwsNewsitems + { + get + { + if ((this._CwsNewsitems == null)) + { + this._CwsNewsitems = this.ChildrenOfType(); + } + return this._CwsNewsitems; + } + set + { + this._CwsNewsitems = value; + } + } + } + + /// + /// This is the news document type for your site and lives beneath the News & Events List document type. + /// + [UmbracoInfo("CWS_NewsItem", Id = 1086)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsNewsitem : DocTypeBase + { + + private string _Bodytext; + + private string _Articlephoto; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private AssociationTree _CwsNewsitems; + + public CwsNewsitem() + { + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("articlePhoto", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephoto + { + get + { + return this._Articlephoto; + } + set + { + if ((this._Articlephoto != value)) + { + this.RaisePropertyChanging(); + this._Articlephoto = value; + this.RaisePropertyChanged("Articlephoto"); + } + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + public AssociationTree CwsNewsitems + { + get + { + if ((this._CwsNewsitems == null)) + { + this._CwsNewsitems = this.ChildrenOfType(); + } + return this._CwsNewsitems; + } + set + { + this._CwsNewsitems = value; + } + } + } + + /// + /// This is the Photo document type for your site and lives beneath the Gallery document type. + /// + [UmbracoInfo("CWS_Photo", Id = 1087)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsPhoto : DocTypeBase + { + + private string _Phototext; + + private string _Photo; + + private string _Photothumbnail; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + public CwsPhoto() + { + } + + /// + /// Enter a description + /// + [UmbracoInfo("photoText", DisplayName = "Photo Text", Mandatory = false)] + [Property()] + public virtual string Phototext + { + get + { + return this._Phototext; + } + set + { + if ((this._Phototext != value)) + { + this.RaisePropertyChanging(); + this._Phototext = value; + this.RaisePropertyChanged("Phototext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("photo", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Photo + { + get + { + return this._Photo; + } + set + { + if ((this._Photo != value)) + { + this.RaisePropertyChanging(); + this._Photo = value; + this.RaisePropertyChanged("Photo"); + } + } + } + + /// + /// 151px x 108px + /// + [UmbracoInfo("photoThumbnail", DisplayName = "Thumbnail", Mandatory = false)] + [Property()] + public virtual string Photothumbnail + { + get + { + return this._Photothumbnail; + } + set + { + if ((this._Photothumbnail != value)) + { + this.RaisePropertyChanging(); + this._Photothumbnail = value; + this.RaisePropertyChanged("Photothumbnail"); + } + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + } + + /// + /// This is the Textpage document type for your site. + /// + [UmbracoInfo("CWS_Textpage", Id = 1088)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsTextpage : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Articlephoto; + + private string _Bodytext; + + private AssociationTree _CwsTextpages; + + private AssociationTree _CwsTextpagetwocols; + + public CwsTextpage() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("articlePhoto", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephoto + { + get + { + return this._Articlephoto; + } + set + { + if ((this._Articlephoto != value)) + { + this.RaisePropertyChanging(); + this._Articlephoto = value; + this.RaisePropertyChanged("Articlephoto"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + + public AssociationTree CwsTextpagetwocols + { + get + { + if ((this._CwsTextpagetwocols == null)) + { + this._CwsTextpagetwocols = this.ChildrenOfType(); + } + return this._CwsTextpagetwocols; + } + set + { + this._CwsTextpagetwocols = value; + } + } + } + + /// + /// This is the Textpage document type for your site which has two columns. + /// + [UmbracoInfo("CWS_TextpageTwoCol", Id = 1089)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsTextpagetwocol : DocTypeBase + { + + private string _Articlephotocolone; + + private string _Articlephotocoltwo; + + private string _Bodytextcoltwo; + + private string _Bodytextcolone; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private AssociationTree _CwsTextpages; + + private AssociationTree _CwsTextpagetwocols; + + public CwsTextpagetwocol() + { + } + + /// + /// + /// + [UmbracoInfo("articlePhotoColOne", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephotocolone + { + get + { + return this._Articlephotocolone; + } + set + { + if ((this._Articlephotocolone != value)) + { + this.RaisePropertyChanging(); + this._Articlephotocolone = value; + this.RaisePropertyChanged("Articlephotocolone"); + } + } + } + + /// + /// + /// + [UmbracoInfo("articlePhotoColTwo", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephotocoltwo + { + get + { + return this._Articlephotocoltwo; + } + set + { + if ((this._Articlephotocoltwo != value)) + { + this.RaisePropertyChanging(); + this._Articlephotocoltwo = value; + this.RaisePropertyChanged("Articlephotocoltwo"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyTextColTwo", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytextcoltwo + { + get + { + return this._Bodytextcoltwo; + } + set + { + if ((this._Bodytextcoltwo != value)) + { + this.RaisePropertyChanging(); + this._Bodytextcoltwo = value; + this.RaisePropertyChanged("Bodytextcoltwo"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyTextColOne", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytextcolone + { + get + { + return this._Bodytextcolone; + } + set + { + if ((this._Bodytextcolone != value)) + { + this.RaisePropertyChanging(); + this._Bodytextcolone = value; + this.RaisePropertyChanged("Bodytextcolone"); + } + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + + public AssociationTree CwsTextpagetwocols + { + get + { + if ((this._CwsTextpagetwocols == null)) + { + this._CwsTextpagetwocols = this.ChildrenOfType(); + } + return this._CwsTextpagetwocols; + } + set + { + this._CwsTextpagetwocols = value; + } + } + } + + /// + /// + /// + [UmbracoInfo("Textpage (Three Col)", Id = 1119)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class TextpageThreeCol : CwsTextpagetwocol + { + + private string _Thirdcontentarea; + + public TextpageThreeCol() + { + } + + /// + /// + /// + [UmbracoInfo("ThirdContentArea", DisplayName = "Third content area", Mandatory = false)] + [Property()] + public virtual string Thirdcontentarea + { + get + { + return this._Thirdcontentarea; + } + set + { + if ((this._Thirdcontentarea != value)) + { + this.RaisePropertyChanging(); + this._Thirdcontentarea = value; + this.RaisePropertyChanged("Thirdcontentarea"); + } + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Properties/AssemblyInfo.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..ad7442479a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Mockable.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +using System.Reflection; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Core")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("Core")] \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/AncestorTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/AncestorTest.cs new file mode 100644 index 0000000000..da90cc316b --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/AncestorTest.cs @@ -0,0 +1,118 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Test; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for AncestorTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class AncestorTest + { + public AncestorTest() + { + // + // TODO: Add constructor logic here + // + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, Isolated] + public void AncestorTest_NoWhereCondition_Exists() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var textPage = ctx.CwsTextpages.First(); + + var hp = textPage.AncestorOrDefault(); + + Assert.IsNotNull(hp); + } + } + + [TestMethod, Isolated] + public void AncestorTest_NoWhereCondition_NotExists() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var textPage = ctx.CwsTextpages.First(); + + var a = textPage.AncestorOrDefault(); + + Assert.IsNull(a); + } + } + + [TestMethod, Isolated] + public void AncestorTest_Where_Exists() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var photo = ctx.CwsPhotos.First(p => p.Name.Contains("umbraco")); + var gallery = photo.AncestorOrDefault(g => g.Name.Contains("Codegarden")); + + Assert.IsNotNull(gallery); + } + } + + [TestMethod, Isolated] + public void AncestorTest_Where_NotExists() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var photo = ctx.CwsPhotos.First(p => p.Name.Contains("umbraco")); + var gallery = photo.AncestorOrDefault(g => g.Name.Contains("Bookhouses")); + + Assert.IsNull(gallery); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/App.config b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/App.config new file mode 100644 index 0000000000..0eb1e54b3e --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/AuthoringTests.txt b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/AuthoringTests.txt new file mode 100644 index 0000000000..64bab9481d --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/AuthoringTests.txt @@ -0,0 +1,136 @@ +========================================================================== + Visual Studio Team System: Overview of Authoring and Running Tests +========================================================================== + +This overview describes the features for authoring and running tests in +Visual Studio Team System and Visual Studio Team Edition for Software Testers. + +Opening Tests +------------- +To open a test, open a test project or a test metadata file (a file with +extension .vsmdi) that contains the definition of the test. You can find +test projects and metadata files in Solution Explorer. + +Viewing Tests +------------- +To see which tests are available to you, open the Test View window. Or, +if you have installed Team Edition for Software Testers, you can also open +the Test List Editor window to view tests. + +To open the Test View window, click the Test menu, point to Windows, and +then click Test View. To open the Test List Editor window (if you have +installed Team Edition for Software Testers), click Test, point to Windows, +and then click Test List Editor. + +Running Tests +------------- +You can run tests from the Test View window and the Test List Editor window. +See Viewing Tests to learn how to open these windows. To run one or more +tests displayed in the Test View window, first select the tests in that +window; to select multiple tests, hold either the Shift or CTRL key while +clicking tests. Then click the Run Tests button in the Test View window +toolbar. + +If you have installed Visual Studio Team Edition for Software Testers, you can +also use the Test List Editor window to run tests. To run tests in Test List Editor, +select the check box next to each test that you want to run. Then click the +Run Tests button in the Test List Editor window toolbar. + +Viewing Test Results +-------------------- +When you run a test or a series of tests, the results of the test run will be +shown in the Test Results window. Each individual test in the run is shown on +a separate line so that you can see its status. The window contains an +embedded status bar in the top half of the window that provides you with +summary details of the complete test run. + +To see more detailed results for a particular test result, double-click it in +the Test Results window. This opens a window that provides more information +about the particular test result, such as any specific error messages returned +by the test. + +Changing the way that tests are run +----------------------------------- +Each time you run one or more tests, a collection of settings is used to +determine how those tests are run. These settings are contained in a “test +run configuration” file. + +Here is a partial list of the changes you can make with a test run +configuration file: + + - Change the naming scheme for each test run. + - Change the test controller that the tests are run on so that you can run + tests remotely. + - Gather code coverage data for the code being tested so that you can see + which lines of code are covered by your tests. + - Enable and disable test deployment. + - Specify additional files to deploy before tests are run. + - Select a different host, ASP.NET, for running ASP.NET unit tests. + - Select a different host, the smart device test host, for running smart device unit tests. + - Set various properties for the test agents that run your tests. + - Run custom scripts at the start and end of each test run so that you can + set up the test environment exactly as required each time tests are run. + - Set time limits for tests and test runs. + - Set the browser mix and the number of times to repeat Web tests in the + test run. + +By default, a test run configuration file is created whenever you create a +new test project. You make changes to this file by double-clicking it in +Solution Explorer and then changing its settings. (Test run configuration +files have the extension .testrunconfig.) + +A solution can contain multiple test run configuration files. Only one of +those files, known as the “Active” test run configuration file, is used to +determine the settings that are currently used for test runs. You select +the active test run configuration by clicking Select Active Test Run +Configuration on the Test menu. + +------------------------------------------------------------------------------- + +Test Types +---------- +Using Visual Studio Team Edition for Software Testers, you can create a number +of different test types: + +Unit test: Use a unit test to create a programmatic test in C++, Visual C# or +Visual Basic that exercises source code. A unit test calls the methods of a +class, passing suitable parameters, and verifies that the returned value is +what you expect. +There are three specialized variants of unit tests: + - Data-driven unit tests are created when you configure a unit test to be + called repeatedly for each row of a data source. The data from each row + is used by the unit test as input data. + - ASP.NET unit tests are unit tests that exercise code in an ASP.NET Web + application. + - Smart device unit tests are unit tests that are deployed to a smart device + or emulator and then executed by the smart device test host. + +Web Test: Web tests consist of an ordered series of HTTP requests that you +record in a browser session using Microsoft Internet Explorer. You can have +the test report specific details about the pages or sites it requests, such +as whether a particular page contains a specified string. + +Load Test: You use a load test to encapsulate non-manual tests, such as +unit, Web, and generic tests, and then run them simultaneously by using +virtual users. Running these tests under load generates test results, +including performance and other counters, in tables and in graphs. + +Generic test: A generic test is an existing program wrapped to function as a +test in Visual Studio. The following are examples of tests or programs that +you can turn into generic tests: + - An existing test that uses process exit codes to communicate whether the + test passed or failed. 0 indicates passing and any other value indicates + a failure. + - A general program to obtain specific functionality during a test scenario. + - A test or program that uses a special XML file (called a “summary results + file”), to communicate detailed results. + +Manual test: The manual test type is used when the test tasks are to be +completed by a test engineer as opposed to an automated script. + +Ordered test: Use an ordered test to execute a set of tests in an order you +specify. + +------------------------------------------------------------------------------- + + diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/CacheTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/CacheTest.cs new file mode 100644 index 0000000000..b61f8582df --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/CacheTest.cs @@ -0,0 +1,93 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Test; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for CacheTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class CacheTest + { + public CacheTest() + { + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, Isolated] + public void CacheTest_ForcedRefresh() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var hps = ctx.CwsHomes; + + ctx.CwsHomes.ReloadCache(); + + var reloadedHps = ctx.CwsHomes; + + Assert.AreNotSame(reloadedHps, hps, "Force reload should result in a different object"); + } + } + + [TestMethod, Isolated] + public void CacheTest_RequeryLoadFromCache() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var hps = ctx.CwsHomes; + + var requeriedHps = ctx.CwsHomes; + + Assert.AreSame(requeriedHps, hps, "Requeried objects should result in the same collection"); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/ChildTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/ChildTest.cs new file mode 100644 index 0000000000..48052dfb8a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/ChildTest.cs @@ -0,0 +1,102 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Test; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for ChildTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class ChildTest + { + public ChildTest() + { + // + // TODO: Add constructor logic here + // + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, Isolated] + public void ChildTest_ChildExist() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var pages = ctx.CwsHomes.First().CwsTextpages; + + Assert.AreNotEqual(0, pages.Count()); + } + } + + [TestMethod, Isolated] + public void ChildTest_ChildToParent() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var page = ctx.CwsHomes.First().CwsTextpages.First(); + + Assert.AreEqual(ctx.CwsHomes.First().Id, page.Parent().Id); + } + } + + [TestMethod, Isolated] + public void ChildTest_AllChildren() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var hp = ctx.CwsHomes.First(); + + Assert.IsTrue(hp.Children.Count() > 0); + Assert.IsInstanceOfType(hp.Children.First(), typeof(CwsTextpage)); + Assert.IsInstanceOfType(hp.Children.Skip(1).First(), typeof(CwsGallerylist)); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj new file mode 100644 index 0000000000..6ca35eb00a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj @@ -0,0 +1,129 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {A80528D0-E68C-4A94-9489-C712216665B0} + Library + Properties + umbraco.Linq.Core.Tests + umbraco.Linq.Core.Tests + v3.5 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\Debug - Fixed Version\ + DEBUG;TRACE + full + AnyCPU + true + GlobalSuppressions.cs + prompt + + + + False + ..\..\..\dep\Reference Assemblies\Umbraco\businesslogic.dll + + + + + 3.5 + + + + 3.5 + + + 3.0 + + + + + 3.5 + + + False + ..\..\..\dep\Reference Assemblies\Mocking\TypeMock.dll + + + False + ..\..\..\dep\Reference Assemblies\Mocking\Typemock.ArrangeActAssert.Dll + + + False + ..\..\..\dep\Reference Assemblies\Umbraco\umbraco.dll + + + False + ..\..\..\dep\Reference Assemblies\Umbraco\umbraco.DataLayer.dll + + + + + Properties\SolutionInfo.cs + + + + + + + + + + + + + + + + + + + + + + {31CAEC36-0C3D-4D69-B092-84866811EA07} + Core + + + + + umbraco.config + PreserveNewest + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj.user b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj.user new file mode 100644 index 0000000000..5c2d6e6a78 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj.user @@ -0,0 +1,5 @@ + + + ShowAllFiles + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj.vspscc b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Core.Tests.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/CwsReplicationTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/CwsReplicationTest.cs new file mode 100644 index 0000000000..f1886de7d7 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/CwsReplicationTest.cs @@ -0,0 +1,85 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Test; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Tests to replicate the functionality of the CWS2 xslt's + /// + [TestClass, DeploymentItem("umbraco.config")] + public class CwsReplicationTest + { + public CwsReplicationTest() + { + + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, Isolated] + public void CwsReplicationTest_ListGalleries() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var galleryList = ctx.CwsGallerylists.First(); //this would really be a Where(g => g.Id == umbracoContext.Current.PageId.Value) but since I'm not really on a page... + + var galleries = from g in galleryList.CwsGalleries + where g.CwsPhotos.Count() >= 1 + orderby g.Name + select new + { + g.Name, + Url = umbraco.library.NiceUrl(g.Id), + Thumbnail = (string.IsNullOrEmpty(g.Gallerythumbnail) ? "/Assets/Placeholders/gallery_placeholder.gif" : g.Gallerythumbnail), + PhotoCount = g.CwsPhotos.Count(), + }; + + Assert.AreEqual(3, galleries.Count()); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/DataContextTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/DataContextTest.cs new file mode 100644 index 0000000000..b44919561f --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/DataContextTest.cs @@ -0,0 +1,145 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Linq.Core.Node; +using umbraco.Test; +using System.IO; +using System.Web; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for DataContextTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class DataContextTest + { + public DataContextTest() + { + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, ExpectedException(typeof(ArgumentNullException))] + public void DataContextTest_FileNameRequired() + { + var nodeProvider = new NodeDataProvider(string.Empty); + } + + [TestMethod, ExpectedException(typeof(FileNotFoundException))] + public void DataContextTest_FileMustExist() + { + var nodeProvider = new NodeDataProvider(@"C:\fakeFile.config"); + } + + [TestMethod] + public void DataContextTest_ConstructFromExistingProvider() + { + var nodeProvider = new NodeDataProvider(Path.Combine(Environment.CurrentDirectory, "umbraco.config")); + + MyumbracoDataContext ctx = new MyumbracoDataContext(nodeProvider); + } + + [TestMethod] + public void DataContextTest_EnsureSchemaValidation() + { + var nodeProvider = new NodeDataProvider(Path.Combine(Environment.CurrentDirectory, "umbraco.config"), true); + + MyumbracoDataContext ctx = new MyumbracoDataContext(nodeProvider); + + var hp = ctx.CwsHomes.First(); + + Assert.IsNotNull(hp); + } + + [TestMethod, Isolated] + public void DataContextTest_DefaultConstructorIsNodeProvider() + { + MockHelpers.SetupFakeHttpContext(); + + var ctx = new MyumbracoDataContext(); + + Assert.IsInstanceOfType(ctx.DataProvider, typeof(NodeDataProvider)); + } + + [TestMethod, Isolated] + public void DataContextTest_NodeCached() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var hp = ctx.CwsHomes.First(); + var hp2 = ctx.CwsHomes.First(); + + Assert.AreSame(hp, hp2); + } + } + + [TestMethod, Isolated] + public void DataContextTest_FullCache() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var one = ctx.CwsHomes; + var two = ctx.CwsHomes; + + Assert.AreSame(one, two); + } + } + + [TestMethod, Isolated] + public void DataContextTest_OfNodeTypes() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var tree = ctx.CwsHomes; + + Assert.IsInstanceOfType(tree, typeof(NodeTree)); + Assert.IsInstanceOfType(tree.First().CwsTextpages, typeof(NodeAssociationTree)); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Extensions.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Extensions.cs new file mode 100644 index 0000000000..ad00d901a4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Extensions.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TypeMock.ArrangeActAssert; + +namespace umbraco.Linq.Core.Tests +{ + public static class Extensions + { + public static ActionRepeater WillReturnRepeat(this IPublicNonVoidMethodHandler ret, TReturn value, int numberOfReturns) + { + for (var i = 0; i < numberOfReturns; i++) + ret.WillReturn(value); + + return new ActionRepeater(ret); + } + + public static ActionRepeater CallOriginalRepeat(this IPublicNonVoidMethodHandler ret, int numberOfReturns) + { + for (var i = 0; i < numberOfReturns; i++) + ret.CallOriginal(); + + return new ActionRepeater(ret); + } + } + + public class ActionRepeater + { + private IPublicNonVoidMethodHandler _actionRepeater; + public ActionRepeater(IPublicNonVoidMethodHandler actionRepeater) + { + _actionRepeater = actionRepeater; + } + + public IPublicNonVoidMethodHandler AndThen() + { + return _actionRepeater; + } + } +} + diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/InheritanceTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/InheritanceTest.cs new file mode 100644 index 0000000000..800d9b51f0 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/InheritanceTest.cs @@ -0,0 +1,80 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Test; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for InheritanceTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class InheritanceTest + { + public InheritanceTest() + { + // + // TODO: Add constructor logic here + // + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod] + public void InheritanceTest_ImplementsBaseClass() + { + var tmp = new TextpageThreeCol(); + + Assert.AreEqual(typeof(CwsTextpagetwocol), tmp.GetType().BaseType); + } + + [TestMethod, Isolated] + public void InheritanceTest_PropertyFromBase() + { + var fake = Isolate.Fake.Instance(); + + Assert.AreEqual(typeof(CwsTextpagetwocol), fake.GetType().GetProperties().Single(p => p.Name == "Headertext").DeclaringType); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/MockHelpers.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/MockHelpers.cs new file mode 100644 index 0000000000..65af51a3d6 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/MockHelpers.cs @@ -0,0 +1,19 @@ +using System; +using System.Web; +using TypeMock.ArrangeActAssert; +using System.IO; + +namespace umbraco.Linq.Core.Tests +{ + internal class MockHelpers + { + public static void SetupFakeHttpContext() + { + HttpContext fakeHttpContext = Isolate.Fake.Instance(Members.MustSpecifyReturnValues); + HttpServerUtility fakeServer = Isolate.Fake.Instance(); + Isolate.WhenCalled(() => HttpContext.Current).WillReturn(fakeHttpContext); + Isolate.WhenCalled(() => fakeHttpContext.Server).WillReturn(fakeServer); + Isolate.WhenCalled(() => fakeServer.MapPath(string.Empty)).WillReturn(Path.Combine(Environment.CurrentDirectory, "umbraco.config")); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/MyUmbraco.designer.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/MyUmbraco.designer.cs new file mode 100644 index 0000000000..5da73a8469 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/MyUmbraco.designer.cs @@ -0,0 +1,3868 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3074 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace umbraco.Test +{ + using umbraco.Linq.Core; + using umbraco.Linq.Core.Node; + using System.Linq; + + + public partial class MyumbracoDataContext : umbracoDataContext + { + + #region Partials + partial void OnCreated(); + #endregion + + + public MyumbracoDataContext() : + base() + { + OnCreated(); + } + + public MyumbracoDataContext(umbracoDataProvider provider) : + base(provider) + { + OnCreated(); + } + + public Tree Runwayhomepages + { + get + { + return this.LoadTree(); + } + } + + public Tree Runwaytextpages + { + get + { + return this.LoadTree(); + } + } + + public Tree ContentFolders + { + get + { + return this.LoadTree(); + } + } + + public Tree Persons + { + get + { + return this.LoadTree(); + } + } + + public Tree InheritedFolders + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsContacts + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsEmailafriends + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsEventitems + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsGallerylists + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsGalleries + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsHomes + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsNewseventslists + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsNewsitems + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsPhotos + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsTextpages + { + get + { + return this.LoadTree(); + } + } + + public Tree CwsTextpagetwocols + { + get + { + return this.LoadTree(); + } + } + + public Tree TextpageThreeCols + { + get + { + return this.LoadTree(); + } + } + } + + /// + /// The homepage of a Runway website. + /// + [UmbracoInfo("RunwayHomepage", Id = 1045)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class Runwayhomepage : DocTypeBase + { + + private string _Bodytext; + + private string _Sitename; + + private string _Sitedescription; + + private AssociationTree _Runwaytextpages; + + public Runwayhomepage() + { + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Body text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("siteName", DisplayName = "Site Name", Mandatory = false)] + [Property()] + public virtual string Sitename + { + get + { + return this._Sitename; + } + set + { + if ((this._Sitename != value)) + { + this.RaisePropertyChanging(); + this._Sitename = value; + this.RaisePropertyChanged("Sitename"); + } + } + } + + /// + /// + /// + [UmbracoInfo("siteDescription", DisplayName = "Site Description", Mandatory = false)] + [Property()] + public virtual string Sitedescription + { + get + { + return this._Sitedescription; + } + set + { + if ((this._Sitedescription != value)) + { + this.RaisePropertyChanging(); + this._Sitedescription = value; + this.RaisePropertyChanged("Sitedescription"); + } + } + } + + public AssociationTree Runwaytextpages + { + get + { + if ((this._Runwaytextpages == null)) + { + this._Runwaytextpages = this.ChildrenOfType(); + } + return this._Runwaytextpages; + } + set + { + this._Runwaytextpages = value; + } + } + } + + /// + /// Runway textpage; this is the standard content page for a Runway website. + /// + [UmbracoInfo("RunwayTextpage", Id = 1046)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class Runwaytextpage : DocTypeBase + { + + private string _Bodytext; + + private int _umbraconavihide; + + private AssociationTree _Runwaytextpages; + + public Runwaytextpage() + { + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Body Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in navigation", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + public AssociationTree Runwaytextpages + { + get + { + if ((this._Runwaytextpages == null)) + { + this._Runwaytextpages = this.ChildrenOfType(); + } + return this._Runwaytextpages; + } + set + { + this._Runwaytextpages = value; + } + } + } + + /// + /// + /// + [UmbracoInfo("Content Folder", Id = 1052)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class ContentFolder : DocTypeBase + { + + private AssociationTree _Persons; + + public ContentFolder() + { + } + + public AssociationTree Persons + { + get + { + if ((this._Persons == null)) + { + this._Persons = this.ChildrenOfType(); + } + return this._Persons; + } + set + { + this._Persons = value; + } + } + } + + /// + /// + /// + [UmbracoInfo("Person", Id = 1053)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class Person : DocTypeBase + { + + private string _Firstname; + + private string _Lastname; + + public Person() + { + } + + /// + /// + /// + [UmbracoInfo("FirstName", DisplayName = "First Name", Mandatory = false)] + [Property()] + public virtual string Firstname + { + get + { + return this._Firstname; + } + set + { + if ((this._Firstname != value)) + { + this.RaisePropertyChanging(); + this._Firstname = value; + this.RaisePropertyChanged("Firstname"); + } + } + } + + /// + /// + /// + [UmbracoInfo("LastName", DisplayName = "Last Name", Mandatory = false)] + [Property()] + public virtual string Lastname + { + get + { + return this._Lastname; + } + set + { + if ((this._Lastname != value)) + { + this.RaisePropertyChanging(); + this._Lastname = value; + this.RaisePropertyChanged("Lastname"); + } + } + } + } + + /// + /// + /// + [UmbracoInfo("Inherited Folder", Id = 1059)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class InheritedFolder : ContentFolder + { + + public InheritedFolder() + { + } + } + + /// + /// This is the contact form document type for your site. + /// + [UmbracoInfo("CWS_Contact", Id = 1079)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsContact : DocTypeBase + { + + private string _Emailto; + + private string _Emailsubject; + + private string _Emailbody; + + private string _Emailreplyfrom; + + private string _Emailreplysubject; + + private string _Emailreplybody; + + private int _Enablessl; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Formtext; + + private string _Thankyouheadertext; + + private string _Thankyoumessagetext; + + private AssociationTree _CwsTextpages; + + public CwsContact() + { + } + + /// + /// The email address that you want the form to be sent to. + /// + [UmbracoInfo("emailTo", DisplayName = "Email To", Mandatory = true)] + [Property()] + public virtual string Emailto + { + get + { + return this._Emailto; + } + set + { + if ((this._Emailto != value)) + { + this.RaisePropertyChanging(); + this._Emailto = value; + this.RaisePropertyChanged("Emailto"); + } + } + } + + /// + /// The subject of the email that will be sent to you. + /// + [UmbracoInfo("emailSubject", DisplayName = "Email Subject", Mandatory = true)] + [Property()] + public virtual string Emailsubject + { + get + { + return this._Emailsubject; + } + set + { + if ((this._Emailsubject != value)) + { + this.RaisePropertyChanging(); + this._Emailsubject = value; + this.RaisePropertyChanged("Emailsubject"); + } + } + } + + /// + /// Use placeholders [Name], [AddressLine1], [AddressLine2], [Email], [Message], [Time] and [Date] + /// + [UmbracoInfo("emailBody", DisplayName = "Email Message", Mandatory = true)] + [Property()] + public virtual string Emailbody + { + get + { + return this._Emailbody; + } + set + { + if ((this._Emailbody != value)) + { + this.RaisePropertyChanging(); + this._Emailbody = value; + this.RaisePropertyChanged("Emailbody"); + } + } + } + + /// + /// The email address that you want the automated reply to be sent from. + /// + [UmbracoInfo("emailReplyFrom", DisplayName = "Email Reply From", Mandatory = true)] + [Property()] + public virtual string Emailreplyfrom + { + get + { + return this._Emailreplyfrom; + } + set + { + if ((this._Emailreplyfrom != value)) + { + this.RaisePropertyChanging(); + this._Emailreplyfrom = value; + this.RaisePropertyChanged("Emailreplyfrom"); + } + } + } + + /// + /// The subject of the email that will be sent as the automated reply. + /// + /// + [UmbracoInfo("emailReplySubject", DisplayName = "Email Reply Subject", Mandatory = false)] + [Property()] + public virtual string Emailreplysubject + { + get + { + return this._Emailreplysubject; + } + set + { + if ((this._Emailreplysubject != value)) + { + this.RaisePropertyChanging(); + this._Emailreplysubject = value; + this.RaisePropertyChanged("Emailreplysubject"); + } + } + } + + /// + /// Use placeholder [Name] + /// + [UmbracoInfo("emailReplyBody", DisplayName = "Email Reply Body", Mandatory = false)] + [Property()] + public virtual string Emailreplybody + { + get + { + return this._Emailreplybody; + } + set + { + if ((this._Emailreplybody != value)) + { + this.RaisePropertyChanging(); + this._Emailreplybody = value; + this.RaisePropertyChanged("Emailreplybody"); + } + } + } + + /// + /// Does your SMTP server require SSL? + /// + [UmbracoInfo("enableSSL", DisplayName = "Enable SSL", Mandatory = false)] + [Property()] + public virtual int Enablessl + { + get + { + return this._Enablessl; + } + set + { + if ((this._Enablessl != value)) + { + this.RaisePropertyChanging(); + this._Enablessl = value; + this.RaisePropertyChanged("Enablessl"); + } + } + } + + private bool EnablesslBoolean + { + get + { + return (this._Enablessl == 0); + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// This is the text that sits to the left of the contact form. + /// + [UmbracoInfo("formText", DisplayName = "Form Text", Mandatory = false)] + [Property()] + public virtual string Formtext + { + get + { + return this._Formtext; + } + set + { + if ((this._Formtext != value)) + { + this.RaisePropertyChanging(); + this._Formtext = value; + this.RaisePropertyChanged("Formtext"); + } + } + } + + /// + /// This is the header for the thankyou the user will see after sumbitting the contact form. + /// + [UmbracoInfo("thankYouHeaderText", DisplayName = "Thank You Header", Mandatory = true)] + [Property()] + public virtual string Thankyouheadertext + { + get + { + return this._Thankyouheadertext; + } + set + { + if ((this._Thankyouheadertext != value)) + { + this.RaisePropertyChanging(); + this._Thankyouheadertext = value; + this.RaisePropertyChanged("Thankyouheadertext"); + } + } + } + + /// + /// This is the thankyou message that the user will see after submitting your form. + /// + [UmbracoInfo("thankYouMessageText", DisplayName = "Thank You Message", Mandatory = true)] + [Property()] + public virtual string Thankyoumessagetext + { + get + { + return this._Thankyoumessagetext; + } + set + { + if ((this._Thankyoumessagetext != value)) + { + this.RaisePropertyChanging(); + this._Thankyoumessagetext = value; + this.RaisePropertyChanged("Thankyoumessagetext"); + } + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + } + + /// + /// This is the email a friend form document type for your site. + /// + [UmbracoInfo("CWS_EmailAFriend", Id = 1080)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsEmailafriend : DocTypeBase + { + + private string _Emailfrom; + + private string _Emailsubjecttofriend; + + private string _Emailmessagetofriend; + + private int _Enablessl; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Thankyouheadertext; + + private string _Thankyoumessagetext; + + private AssociationTree _CwsTextpages; + + public CwsEmailafriend() + { + } + + /// + /// The email address that you want the email to be sent from. + /// + [UmbracoInfo("emailFrom", DisplayName = "Email From", Mandatory = true)] + [Property()] + public virtual string Emailfrom + { + get + { + return this._Emailfrom; + } + set + { + if ((this._Emailfrom != value)) + { + this.RaisePropertyChanging(); + this._Emailfrom = value; + this.RaisePropertyChanged("Emailfrom"); + } + } + } + + /// + /// The subject of the email that will be sent to the friend. + /// + [UmbracoInfo("emailSubjectToFriend", DisplayName = "Email Subject to Friend", Mandatory = true)] + [Property()] + public virtual string Emailsubjecttofriend + { + get + { + return this._Emailsubjecttofriend; + } + set + { + if ((this._Emailsubjecttofriend != value)) + { + this.RaisePropertyChanging(); + this._Emailsubjecttofriend = value; + this.RaisePropertyChanged("Emailsubjecttofriend"); + } + } + } + + /// + /// Use placeholders [FriendName], [FriendEmail], [YourName], [YourEmail], [Message], [Date], [Time], [URL] + /// + [UmbracoInfo("emailMessageToFriend", DisplayName = "Email Message to Friend", Mandatory = true)] + [Property()] + public virtual string Emailmessagetofriend + { + get + { + return this._Emailmessagetofriend; + } + set + { + if ((this._Emailmessagetofriend != value)) + { + this.RaisePropertyChanging(); + this._Emailmessagetofriend = value; + this.RaisePropertyChanged("Emailmessagetofriend"); + } + } + } + + /// + /// Does your SMTP server require SSL? + /// + [UmbracoInfo("enableSSL", DisplayName = "Enable SSL", Mandatory = false)] + [Property()] + public virtual int Enablessl + { + get + { + return this._Enablessl; + } + set + { + if ((this._Enablessl != value)) + { + this.RaisePropertyChanging(); + this._Enablessl = value; + this.RaisePropertyChanged("Enablessl"); + } + } + } + + private bool EnablesslBoolean + { + get + { + return (this._Enablessl == 0); + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// This is the header for the thankyou the user will see after sumbitting the contact form. + /// + [UmbracoInfo("thankYouHeaderText", DisplayName = "Thank You Header", Mandatory = true)] + [Property()] + public virtual string Thankyouheadertext + { + get + { + return this._Thankyouheadertext; + } + set + { + if ((this._Thankyouheadertext != value)) + { + this.RaisePropertyChanging(); + this._Thankyouheadertext = value; + this.RaisePropertyChanged("Thankyouheadertext"); + } + } + } + + /// + /// This is the thankyou message that the user will see after submitting your form. + /// + [UmbracoInfo("thankYouMessageText", DisplayName = "Thank You Text", Mandatory = true)] + [Property()] + public virtual string Thankyoumessagetext + { + get + { + return this._Thankyoumessagetext; + } + set + { + if ((this._Thankyoumessagetext != value)) + { + this.RaisePropertyChanging(); + this._Thankyoumessagetext = value; + this.RaisePropertyChanged("Thankyoumessagetext"); + } + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + } + + /// + /// This is the event document type for your site and lives beneath the News & Events List document type. + /// + [UmbracoInfo("CWS_EventItem", Id = 1081)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsEventitem : DocTypeBase + { + + private System.DateTime _Eventdate; + + private string _Bodytext; + + private string _Articlephoto; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + public CwsEventitem() + { + } + + /// + /// + /// + [UmbracoInfo("eventDate", DisplayName = "Date", Mandatory = false)] + [Property()] + public virtual System.DateTime Eventdate + { + get + { + return this._Eventdate; + } + set + { + if ((this._Eventdate != value)) + { + this.RaisePropertyChanging(); + this._Eventdate = value; + this.RaisePropertyChanged("Eventdate"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("articlePhoto", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephoto + { + get + { + return this._Articlephoto; + } + set + { + if ((this._Articlephoto != value)) + { + this.RaisePropertyChanging(); + this._Articlephoto = value; + this.RaisePropertyChanged("Articlephoto"); + } + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + } + + /// + /// This is the Galleries document type for your site which stores the Gallery document type as children. + /// + [UmbracoInfo("CWS_GalleryList", Id = 1082)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsGallerylist : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Sortby; + + private string _Sortorder; + + private AssociationTree _CwsGalleries; + + public CwsGallerylist() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortBy", DisplayName = "Sort By", Mandatory = true)] + [Property()] + public virtual string Sortby + { + get + { + return this._Sortby; + } + set + { + if ((this._Sortby != value)) + { + this.RaisePropertyChanging(); + this._Sortby = value; + this.RaisePropertyChanged("Sortby"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortOrder", DisplayName = "Sort Order", Mandatory = true)] + [Property()] + public virtual string Sortorder + { + get + { + return this._Sortorder; + } + set + { + if ((this._Sortorder != value)) + { + this.RaisePropertyChanging(); + this._Sortorder = value; + this.RaisePropertyChanged("Sortorder"); + } + } + } + + public AssociationTree CwsGalleries + { + get + { + if ((this._CwsGalleries == null)) + { + this._CwsGalleries = this.ChildrenOfType(); + } + return this._CwsGalleries; + } + set + { + this._CwsGalleries = value; + } + } + } + + /// + /// This is the gallery document type which stores the Photo document type as children. + /// + [UmbracoInfo("CWS_Gallery", Id = 1083)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsGallery : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Sortby; + + private string _Sortorder; + + private string _Gallerythumbnail; + + private AssociationTree _CwsPhotos; + + public CwsGallery() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortBy", DisplayName = "Sort By", Mandatory = true)] + [Property()] + public virtual string Sortby + { + get + { + return this._Sortby; + } + set + { + if ((this._Sortby != value)) + { + this.RaisePropertyChanging(); + this._Sortby = value; + this.RaisePropertyChanged("Sortby"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortOrder", DisplayName = "Sort Order", Mandatory = true)] + [Property()] + public virtual string Sortorder + { + get + { + return this._Sortorder; + } + set + { + if ((this._Sortorder != value)) + { + this.RaisePropertyChanging(); + this._Sortorder = value; + this.RaisePropertyChanged("Sortorder"); + } + } + } + + /// + /// 208px x 108px + /// + [UmbracoInfo("galleryThumbnail", DisplayName = "Thumbnail for Gallery", Mandatory = false)] + [Property()] + public virtual string Gallerythumbnail + { + get + { + return this._Gallerythumbnail; + } + set + { + if ((this._Gallerythumbnail != value)) + { + this.RaisePropertyChanging(); + this._Gallerythumbnail = value; + this.RaisePropertyChanged("Gallerythumbnail"); + } + } + } + + public AssociationTree CwsPhotos + { + get + { + if ((this._CwsPhotos == null)) + { + this._CwsPhotos = this.ChildrenOfType(); + } + return this._CwsPhotos; + } + set + { + this._CwsPhotos = value; + } + } + } + + /// + /// This is the homepage document type for your site. + /// + [UmbracoInfo("CWS_Home", Id = 1084)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsHome : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Sitename; + + private string _Headertext; + + private string _Homepagephoto; + + private string _Bodytext; + + private AssociationTree _CwsContacts; + + private AssociationTree _CwsEmailafriends; + + private AssociationTree _CwsGallerylists; + + private AssociationTree _CwsNewseventslists; + + private AssociationTree _CwsTextpages; + + private AssociationTree _CwsTextpagetwocols; + + public CwsHome() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// This is what your site is called. + /// + [UmbracoInfo("siteName", DisplayName = "Site Name", Mandatory = false)] + [Property()] + public virtual string Sitename + { + get + { + return this._Sitename; + } + set + { + if ((this._Sitename != value)) + { + this.RaisePropertyChanging(); + this._Sitename = value; + this.RaisePropertyChanged("Sitename"); + } + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("homepagePhoto", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Homepagephoto + { + get + { + return this._Homepagephoto; + } + set + { + if ((this._Homepagephoto != value)) + { + this.RaisePropertyChanging(); + this._Homepagephoto = value; + this.RaisePropertyChanged("Homepagephoto"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + public AssociationTree CwsContacts + { + get + { + if ((this._CwsContacts == null)) + { + this._CwsContacts = this.ChildrenOfType(); + } + return this._CwsContacts; + } + set + { + this._CwsContacts = value; + } + } + + public AssociationTree CwsEmailafriends + { + get + { + if ((this._CwsEmailafriends == null)) + { + this._CwsEmailafriends = this.ChildrenOfType(); + } + return this._CwsEmailafriends; + } + set + { + this._CwsEmailafriends = value; + } + } + + public AssociationTree CwsGallerylists + { + get + { + if ((this._CwsGallerylists == null)) + { + this._CwsGallerylists = this.ChildrenOfType(); + } + return this._CwsGallerylists; + } + set + { + this._CwsGallerylists = value; + } + } + + public AssociationTree CwsNewseventslists + { + get + { + if ((this._CwsNewseventslists == null)) + { + this._CwsNewseventslists = this.ChildrenOfType(); + } + return this._CwsNewseventslists; + } + set + { + this._CwsNewseventslists = value; + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + + public AssociationTree CwsTextpagetwocols + { + get + { + if ((this._CwsTextpagetwocols == null)) + { + this._CwsTextpagetwocols = this.ChildrenOfType(); + } + return this._CwsTextpagetwocols; + } + set + { + this._CwsTextpagetwocols = value; + } + } + } + + /// + /// This is the News & Events List document type for your site which stores the News and Event Item document types as children. + /// + [UmbracoInfo("CWS_NewsEventsList", Id = 1085)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsNewseventslist : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Sortby; + + private string _Sortorder; + + private string _Headertext; + + private AssociationTree _CwsEventitems; + + private AssociationTree _CwsNewsitems; + + public CwsNewseventslist() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortBy", DisplayName = "Sort By", Mandatory = true)] + [Property()] + public virtual string Sortby + { + get + { + return this._Sortby; + } + set + { + if ((this._Sortby != value)) + { + this.RaisePropertyChanging(); + this._Sortby = value; + this.RaisePropertyChanged("Sortby"); + } + } + } + + /// + /// Choose how you want to sort the child items. + /// + [UmbracoInfo("sortOrder", DisplayName = "Sort Order", Mandatory = true)] + [Property()] + public virtual string Sortorder + { + get + { + return this._Sortorder; + } + set + { + if ((this._Sortorder != value)) + { + this.RaisePropertyChanging(); + this._Sortorder = value; + this.RaisePropertyChanged("Sortorder"); + } + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + public AssociationTree CwsEventitems + { + get + { + if ((this._CwsEventitems == null)) + { + this._CwsEventitems = this.ChildrenOfType(); + } + return this._CwsEventitems; + } + set + { + this._CwsEventitems = value; + } + } + + public AssociationTree CwsNewsitems + { + get + { + if ((this._CwsNewsitems == null)) + { + this._CwsNewsitems = this.ChildrenOfType(); + } + return this._CwsNewsitems; + } + set + { + this._CwsNewsitems = value; + } + } + } + + /// + /// This is the news document type for your site and lives beneath the News & Events List document type. + /// + [UmbracoInfo("CWS_NewsItem", Id = 1086)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsNewsitem : DocTypeBase + { + + private string _Bodytext; + + private string _Articlephoto; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private AssociationTree _CwsNewsitems; + + public CwsNewsitem() + { + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("articlePhoto", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephoto + { + get + { + return this._Articlephoto; + } + set + { + if ((this._Articlephoto != value)) + { + this.RaisePropertyChanging(); + this._Articlephoto = value; + this.RaisePropertyChanged("Articlephoto"); + } + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + public AssociationTree CwsNewsitems + { + get + { + if ((this._CwsNewsitems == null)) + { + this._CwsNewsitems = this.ChildrenOfType(); + } + return this._CwsNewsitems; + } + set + { + this._CwsNewsitems = value; + } + } + } + + /// + /// This is the Photo document type for your site and lives beneath the Gallery document type. + /// + [UmbracoInfo("CWS_Photo", Id = 1087)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsPhoto : DocTypeBase + { + + private string _Phototext; + + private string _Photo; + + private string _Photothumbnail; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + public CwsPhoto() + { + } + + /// + /// Enter a description + /// + [UmbracoInfo("photoText", DisplayName = "Photo Text", Mandatory = false)] + [Property()] + public virtual string Phototext + { + get + { + return this._Phototext; + } + set + { + if ((this._Phototext != value)) + { + this.RaisePropertyChanging(); + this._Phototext = value; + this.RaisePropertyChanged("Phototext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("photo", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Photo + { + get + { + return this._Photo; + } + set + { + if ((this._Photo != value)) + { + this.RaisePropertyChanging(); + this._Photo = value; + this.RaisePropertyChanged("Photo"); + } + } + } + + /// + /// 151px x 108px + /// + [UmbracoInfo("photoThumbnail", DisplayName = "Thumbnail", Mandatory = false)] + [Property()] + public virtual string Photothumbnail + { + get + { + return this._Photothumbnail; + } + set + { + if ((this._Photothumbnail != value)) + { + this.RaisePropertyChanging(); + this._Photothumbnail = value; + this.RaisePropertyChanged("Photothumbnail"); + } + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + } + + /// + /// This is the Textpage document type for your site. + /// + [UmbracoInfo("CWS_Textpage", Id = 1088)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsTextpage : DocTypeBase + { + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private string _Articlephoto; + + private string _Bodytext; + + private AssociationTree _CwsTextpages; + + private AssociationTree _CwsTextpagetwocols; + + public CwsTextpage() + { + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + /// + /// + /// + [UmbracoInfo("articlePhoto", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephoto + { + get + { + return this._Articlephoto; + } + set + { + if ((this._Articlephoto != value)) + { + this.RaisePropertyChanging(); + this._Articlephoto = value; + this.RaisePropertyChanged("Articlephoto"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyText", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytext + { + get + { + return this._Bodytext; + } + set + { + if ((this._Bodytext != value)) + { + this.RaisePropertyChanging(); + this._Bodytext = value; + this.RaisePropertyChanged("Bodytext"); + } + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + + public AssociationTree CwsTextpagetwocols + { + get + { + if ((this._CwsTextpagetwocols == null)) + { + this._CwsTextpagetwocols = this.ChildrenOfType(); + } + return this._CwsTextpagetwocols; + } + set + { + this._CwsTextpagetwocols = value; + } + } + } + + /// + /// This is the Textpage document type for your site which has two columns. + /// + [UmbracoInfo("CWS_TextpageTwoCol", Id = 1089)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class CwsTextpagetwocol : DocTypeBase + { + + private string _Articlephotocolone; + + private string _Articlephotocoltwo; + + private string _Bodytextcoltwo; + + private string _Bodytextcolone; + + private string _umbracourlname; + + private string _umbracourlalias; + + private string _Metadescription; + + private string _Metakeywords; + + private int _umbracoredirect; + + private int _umbraconavihide; + + private string _Headertext; + + private AssociationTree _CwsTextpages; + + private AssociationTree _CwsTextpagetwocols; + + public CwsTextpagetwocol() + { + } + + /// + /// + /// + [UmbracoInfo("articlePhotoColOne", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephotocolone + { + get + { + return this._Articlephotocolone; + } + set + { + if ((this._Articlephotocolone != value)) + { + this.RaisePropertyChanging(); + this._Articlephotocolone = value; + this.RaisePropertyChanged("Articlephotocolone"); + } + } + } + + /// + /// + /// + [UmbracoInfo("articlePhotoColTwo", DisplayName = "Photo", Mandatory = false)] + [Property()] + public virtual string Articlephotocoltwo + { + get + { + return this._Articlephotocoltwo; + } + set + { + if ((this._Articlephotocoltwo != value)) + { + this.RaisePropertyChanging(); + this._Articlephotocoltwo = value; + this.RaisePropertyChanged("Articlephotocoltwo"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyTextColTwo", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytextcoltwo + { + get + { + return this._Bodytextcoltwo; + } + set + { + if ((this._Bodytextcoltwo != value)) + { + this.RaisePropertyChanging(); + this._Bodytextcoltwo = value; + this.RaisePropertyChanged("Bodytextcoltwo"); + } + } + } + + /// + /// + /// + [UmbracoInfo("bodyTextColOne", DisplayName = "Text", Mandatory = false)] + [Property()] + public virtual string Bodytextcolone + { + get + { + return this._Bodytextcolone; + } + set + { + if ((this._Bodytextcolone != value)) + { + this.RaisePropertyChanging(); + this._Bodytextcolone = value; + this.RaisePropertyChanged("Bodytextcolone"); + } + } + } + + /// + /// If you wish to change the URL of the node without changing the node name fill this in. + /// + ///eg: warren + /// + [UmbracoInfo("umbracoUrlName", DisplayName = "umbraco URL Name", Mandatory = false)] + [Property()] + public virtual string umbracourlname + { + get + { + return this._umbracourlname; + } + set + { + if ((this._umbracourlname != value)) + { + this.RaisePropertyChanging(); + this._umbracourlname = value; + this.RaisePropertyChanged("umbracourlname"); + } + } + } + + /// + /// Use this to give a node multiple urls. + /// + ///eg: home,homepage/another-level + /// + [UmbracoInfo("umbracoUrlAlias", DisplayName = "umbraco URL Alias", Mandatory = false)] + [Property()] + public virtual string umbracourlalias + { + get + { + return this._umbracourlalias; + } + set + { + if ((this._umbracourlalias != value)) + { + this.RaisePropertyChanging(); + this._umbracourlalias = value; + this.RaisePropertyChanged("umbracourlalias"); + } + } + } + + /// + /// Enter the description for the page. + /// + [UmbracoInfo("metaDescription", DisplayName = "Meta Description", Mandatory = false)] + [Property()] + public virtual string Metadescription + { + get + { + return this._Metadescription; + } + set + { + if ((this._Metadescription != value)) + { + this.RaisePropertyChanging(); + this._Metadescription = value; + this.RaisePropertyChanged("Metadescription"); + } + } + } + + /// + /// Enter a comma seperated list of keywords. + ///warren, keyword, test + /// + [UmbracoInfo("metaKeywords", DisplayName = "Meta Keywords", Mandatory = false)] + [Property()] + public virtual string Metakeywords + { + get + { + return this._Metakeywords; + } + set + { + if ((this._Metakeywords != value)) + { + this.RaisePropertyChanging(); + this._Metakeywords = value; + this.RaisePropertyChanged("Metakeywords"); + } + } + } + + /// + /// Pick a node you wish to redirect to if the user lands on this node. + /// + [UmbracoInfo("umbracoRedirect", DisplayName = " umbraco Redirect", Mandatory = false)] + [Property()] + public virtual int umbracoredirect + { + get + { + return this._umbracoredirect; + } + set + { + if ((this._umbracoredirect != value)) + { + this.RaisePropertyChanging(); + this._umbracoredirect = value; + this.RaisePropertyChanged("umbracoredirect"); + } + } + } + + /// + /// Use this property if you wish to hide this page in the navigation. + /// + [UmbracoInfo("umbracoNaviHide", DisplayName = "Hide in Navi", Mandatory = false)] + [Property()] + public virtual int umbraconavihide + { + get + { + return this._umbraconavihide; + } + set + { + if ((this._umbraconavihide != value)) + { + this.RaisePropertyChanging(); + this._umbraconavihide = value; + this.RaisePropertyChanged("umbraconavihide"); + } + } + } + + private bool umbraconavihideBoolean + { + get + { + return (this._umbraconavihide == 0); + } + } + + /// + /// + /// + [UmbracoInfo("headerText", DisplayName = "Header", Mandatory = false)] + [Property()] + public virtual string Headertext + { + get + { + return this._Headertext; + } + set + { + if ((this._Headertext != value)) + { + this.RaisePropertyChanging(); + this._Headertext = value; + this.RaisePropertyChanged("Headertext"); + } + } + } + + public AssociationTree CwsTextpages + { + get + { + if ((this._CwsTextpages == null)) + { + this._CwsTextpages = this.ChildrenOfType(); + } + return this._CwsTextpages; + } + set + { + this._CwsTextpages = value; + } + } + + public AssociationTree CwsTextpagetwocols + { + get + { + if ((this._CwsTextpagetwocols == null)) + { + this._CwsTextpagetwocols = this.ChildrenOfType(); + } + return this._CwsTextpagetwocols; + } + set + { + this._CwsTextpagetwocols = value; + } + } + } + + /// + /// + /// + [UmbracoInfo("Textpage (Three Col)", Id = 1119)] + [System.Runtime.Serialization.DataContractAttribute()] + [DocType()] + public partial class TextpageThreeCol : CwsTextpagetwocol + { + + private string _Thirdcontentarea; + + public TextpageThreeCol() + { + } + + /// + /// + /// + [UmbracoInfo("ThirdContentArea", DisplayName = "Third content area", Mandatory = false)] + [Property()] + public virtual string Thirdcontentarea + { + get + { + return this._Thirdcontentarea; + } + set + { + if ((this._Thirdcontentarea != value)) + { + this.RaisePropertyChanging(); + this._Thirdcontentarea = value; + this.RaisePropertyChanged("Thirdcontentarea"); + } + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/OrderingTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/OrderingTest.cs new file mode 100644 index 0000000000..17bd817d6c --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/OrderingTest.cs @@ -0,0 +1,81 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Test; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for OrderingTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class OrderingTest + { + public OrderingTest() + { + // + // TODO: Add constructor logic here + // + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, Isolated] + public void OrderingTest_Date() + { + MockHelpers.SetupFakeHttpContext(); + + using (var orderedContext = new MyumbracoDataContext()) + { + var asc = orderedContext.CwsTextpages.OrderBy(p => p.CreateDate); + + var desc = orderedContext.CwsTextpages.OrderByDescending(p => p.CreateDate); + + Assert.AreEqual(asc.Count(), desc.Count()); + Assert.AreNotEqual(asc.First().Id, desc.First().Id); + Assert.AreEqual(asc.First().Id, desc.Last().Id); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/ParentTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/ParentTest.cs new file mode 100644 index 0000000000..6a101734f6 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/ParentTest.cs @@ -0,0 +1,109 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Test; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for ParentTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class ParentTest + { + public ParentTest() + { + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, Isolated] + public void ParentTest_ParentIdExists() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var p = ctx.CwsTextpages.First(); + Assert.AreNotEqual(0, p.ParentNodeId); + } + } + + [TestMethod, Isolated] + public void ParentTest_ParentCreated() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var page = ctx.CwsTextpages.Single(p => p.Id == 1099); + + Assert.AreEqual(1098, page.ParentNodeId); + + var parent = page.Parent(); + + Assert.AreEqual(page.ParentNodeId, parent.Id); + } + } + + [TestMethod, Isolated] + public void ParentTest_TopParentNull() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var hp = ctx.CwsHomes.First(); + Assert.IsNull(hp.Parent()); + } + } + + [TestMethod, Isolated, ExpectedException(typeof(DocTypeMissMatchException))] + public void ParentTest_InvalidParentType() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var p = ctx.CwsPhotos.First().Parent(); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Properties/AssemblyInfo.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..ad7442479a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +using System.Reflection; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Core")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("Core")] \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/SelectTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/SelectTest.cs new file mode 100644 index 0000000000..19a66152b9 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/SelectTest.cs @@ -0,0 +1,179 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using umbraco.Test; +using TypeMock.ArrangeActAssert; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for SelectTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class SelectTest + { + public SelectTest() + { + // + // TODO: Add constructor logic here + // + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, Isolated] + public void SelectTest_LoopTree_Query() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var homePages = from hp in ctx.CwsHomes + select hp; + + Assert.IsNotNull(homePages); + foreach (var item in homePages) + { + Assert.IsTrue(item.Bodytext.Length > 0); + } + } + } + + [TestMethod, Isolated] + public void SelectTest_LoopTree_Lambda() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var homePages = ctx.CwsHomes; + + Assert.IsNotNull(homePages); + foreach (CwsHome item in homePages) + { + Assert.IsTrue(item.Bodytext.Length > 0); + } + } + } + + [TestMethod, Isolated] + public void SelectTest_SingleProperty_Query() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var homePageText = from hp in ctx.CwsHomes + select hp.Bodytext; + + Assert.IsNotNull(homePageText); + foreach (var item in homePageText) + { + Assert.IsNotNull(item); + } + } + } + + [TestMethod, Isolated] + public void SelectTest_SingleProperty_Lambda() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var homePageText = ctx.CwsHomes.Select(hp => hp.Bodytext); + + Assert.IsNotNull(homePageText); + foreach (var item in homePageText) + { + Assert.IsNotNull(item); + } + } + } + + [TestMethod, Isolated] + public void SelectTest_Anonymous_Query() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var anon = from hp in ctx.CwsHomes + select new + { + hp.Bodytext, + CreatedDate = hp.CreateDate + }; + + Assert.IsNotNull(anon); + foreach (var item in anon) + { + Assert.IsNotNull(item.Bodytext); + Assert.AreNotEqual(DateTime.MinValue, item.CreatedDate); + } + } + } + + [TestMethod, Isolated] + public void SelectTest_Anonymous_Lambda() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var anon = ctx.CwsHomes.Select(hp => new + { + hp.Bodytext, + CreatedDate = hp.CreateDate + }); + + Assert.IsNotNull(anon); + foreach (var item in anon) + { + Assert.IsNotNull(item.Bodytext); + Assert.AreNotEqual(DateTime.MinValue, item.CreatedDate); + } + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core.Tests/WhereTest.cs b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/WhereTest.cs new file mode 100644 index 0000000000..7f53ee6c16 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core.Tests/WhereTest.cs @@ -0,0 +1,130 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.Test; + +namespace umbraco.Linq.Core.Tests +{ + /// + /// Summary description for WhereTest + /// + [TestClass, DeploymentItem("umbraco.config")] + public class WhereTest + { + public WhereTest() + { + // + // TODO: Add constructor logic here + // + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod, Isolated] + public void WhereTest_SingleParameter_Query() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var pages = from page in ctx.CwsTextpages + where page.Bodytext.Length > 0 + select page; + + Assert.IsNotNull(pages); + Assert.IsTrue(pages.Count() > 0); + } + } + + [TestMethod, Isolated] + public void WhereTest_DateTimeGreaterThan_Query() + { + MockHelpers.SetupFakeHttpContext(); + + using (var ctx = new MyumbracoDataContext()) + { + var pages = from page in ctx.CwsTextpages + where page.CreateDate > DateTime.MinValue + select page; + + Assert.IsNotNull(pages); + Assert.IsTrue(pages.Count() > 0); + } + } + + [TestMethod, Isolated] + public void WhereTest_TwoParameter_Query() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var pages = from page in ctx.CwsTextpages + where page.Bodytext.Length > 0 + && page.CreateDate > DateTime.MinValue + select page; + + Assert.IsNotNull(pages); + Assert.IsTrue(pages.Count() > 0); + } + } + + [TestMethod, Isolated] + public void WhereTest_ToAnonymous() + { + MockHelpers.SetupFakeHttpContext(); + using (var ctx = new MyumbracoDataContext()) + { + var pages = from page in ctx.CwsTextpages + where page.Bodytext.Length > 0 + select new + { + page.Id, + page.Bodytext + }; + + Assert.AreNotEqual(0, pages.Count()); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/AssociationTree.cs b/LinqToUmbraco/src/umbraco.Linq/Core/AssociationTree.cs new file mode 100644 index 0000000000..de9f54cbec --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/AssociationTree.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.Linq.Core +{ + /// + /// Represents the child items of TDocTypeBase + /// + /// + /// This is used for creating a DataProvider specific child item collection of a DocType instance. + /// + /// It allows a DocType to have strongly typed child associations, and accessors such as: + /// + /// myDocType.SomeChildTypes + /// + /// + /// The type of the DocTypeBase which this association represents. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] + public abstract class AssociationTree : Tree where TDocTypeBase : DocTypeBase, new() + { + /// + /// Gets or sets the parent node id which this AssociationTree is for + /// + /// The parent node id. + public int ParentNodeId { get; protected set; } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Attributes.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Attributes.cs new file mode 100644 index 0000000000..2a804cf68b --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Attributes.cs @@ -0,0 +1,89 @@ +using System; + +namespace umbraco.Linq.Core +{ + /// + /// Standard umbraco info + /// + [global::System.AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] + public sealed class UmbracoInfoAttribute : Attribute + { + /// + /// Initializes a new instance of the class. + /// + /// The alias for this piece of umbraco info. + public UmbracoInfoAttribute(string alias) + { + this.Alias = alias; + } + + /// + /// Gets or sets the display name of the item. + /// + /// The display name. + public string DisplayName { get; set; } + /// + /// Gets or sets the alias. + /// + /// The alias. + public string Alias { get; private set; } + /// + /// Gets or sets a value indicating whether this property is mandatory. + /// + /// true if mandatory; otherwise, false. + public bool Mandatory { get; set; } + /// + /// Gets or sets the DocumentTypeId + /// + /// The id. + public int Id { get; set; } + } + + /// + /// Marks a class as an umbraco DocType + /// + [global::System.AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)] + public sealed class DocTypeAttribute : Attribute + { + /// + /// Initializes a new instance of the class. + /// + public DocTypeAttribute() + { + } + } + + /// + /// Marks a property as a standard umbraco field + /// + /// + /// Example usage: + /// - ID + /// - ParentID + /// - CreateDate + /// + [global::System.AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] + public sealed class FieldAttribute : Attribute + { + /// + /// Initializes a new instance of the class. + /// + public FieldAttribute() + { + } + } + + /// + /// Marks a property as a custom umbraco DocType property + /// + [global::System.AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] + public sealed class PropertyAttribute : Attribute + { + /// + /// Initializes a new instance of the class. + /// + public PropertyAttribute() + { + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/CoreClasses.cd b/LinqToUmbraco/src/umbraco.Linq/Core/CoreClasses.cd new file mode 100644 index 0000000000..bd7035db9c --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/CoreClasses.cd @@ -0,0 +1,80 @@ + + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAA= + AssociationTree.cs + + + + + + MAASJAACAQCEAAAgAACUYQQBgACAAAAgEAIBAAEEAYI= + DocTypeBase.cs + + + + + + + AAACAAAAAAAEABAQAAAAAAAAABAAAAAEAAAAAAAAAAA= + Tree.cs + + + + + + + AAAAAAAAACAEAAAAAAAAAABAAAAAAAAAAAAACACAAAA= + umbracoDataContext.cs + + + + + + + + + + AAAAABAAAAAAABAQAAAAAAAAAAAAAAAAAAAAAAAAAAA= + Node\NodeAssociationTree.cs + + + + + + + + + AAAAiAAAACAEAAQAAAABCKQAAAAAAAAAAAACCAiAAAA= + Node\NodeDataProvider.cs + + + + + + + + + AAACABAAAAAAABAQAAAAAAAAABAAAAAAAAAAAAAAAAA= + Node\NodeTree.cs + + + + + + AAAAgAAAACAAAAQAAAABAAQAAAAAAAAAAAAAAACAAAA= + umbracoDataProvider.cs + + + + + + + AAAAAAAAAAAEAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAA= + ITree.cs + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/DocTypeBase.cs b/LinqToUmbraco/src/umbraco.Linq/Core/DocTypeBase.cs new file mode 100644 index 0000000000..5f67eabfc6 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/DocTypeBase.cs @@ -0,0 +1,367 @@ +using System; +using System.ComponentModel; +using System.Linq; +using System.Reflection; +using System.Runtime.Serialization; +using umbraco.BusinessLogic; +using System.Xml.Linq; +using System.Collections.Generic; + +namespace umbraco.Linq.Core +{ + /// + /// Provides the base framework for an umbraco item + /// + [DataContract] + public class DocTypeBase : INotifyPropertyChanging, INotifyPropertyChanged //This class should be abstract but it can't be done AND achieve the Children property like this + { + #region Internal Storage + private int _Id; + private string _name; + private string _versionId; + private int _parentId; + private int _writerID; + private User _writer; + private int _creatorID; + private User _creator; + private IEnumerable _ancestors; + private AssociationTree _children; + #endregion + + /// + /// Initializes a new instance of the class. + /// + public DocTypeBase() + { + this.IsDirty = true; + } + + internal void LoadFromXml(XElement xml) + { + if (xml.Name != "node") + { + throw new ArgumentException("Xml provided is not valid"); + } + + if (!ReflectionAssistance.CompareByAlias(this.GetType(), xml)) + { + throw new DocTypeMissMatchException((string)xml.Attribute("nodeTypeAlias"), ReflectionAssistance.GetumbracoInfoAttribute(this.GetType()).Alias); + } + + this.Id = (int)xml.Attribute("id"); + this.ParentNodeId = (int)xml.Attribute("parentID"); + this.Name = (string)xml.Attribute("nodeName"); + this.Version = (string)xml.Attribute("version"); + this.CreateDate = (DateTime)xml.Attribute("createDate"); + this.SortOrder = (int)xml.Attribute("sortOrder"); + this.UpdateDate = (DateTime)xml.Attribute("updateDate"); + this._creatorID = (int)xml.Attribute("creatorID"); + this._writerID = (int)xml.Attribute("writerID"); + this.Level = (int)xml.Attribute("level"); + + var properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => p.GetCustomAttributes(typeof(PropertyAttribute), true).Count() > 0); + foreach (var p in properties) + { + var attr = ReflectionAssistance.GetumbracoInfoAttribute(p); + + var data = xml.Elements("data").Single(x => (string)x.Attribute("alias") == attr.Alias); + // TODO: Address how Convert.ChangeType works in globalisation + p.SetValue(this, Convert.ChangeType(data.Value, p.PropertyType), null); + } + } + + internal umbracoDataProvider Provider { get; set; } + + /// + /// Gets or sets a value indicating whether this instance has been modified since it was first loaded + /// + /// true if this instance has been modified; otherwise, false. + public bool IsDirty { get; protected internal set; } + + #region Fields + /// + /// Gets or sets the id of the umbraco item + /// + /// The id. + [Field] + [UmbracoInfo("id", DisplayName = "Id", Mandatory = true), DataMember(Name = "Id")] + public virtual int Id + { + get + { + return this._Id; + } + protected set + { + if (this._Id != value) + { + this.RaisePropertyChanging(); + this._Id = value; + this.RaisePropertyChanged("Id"); + } + } + } + + /// + /// Gets or sets the name (title) of the umbraco item + /// + /// The name. + [Field] + [UmbracoInfo("nodeName", DisplayName = "Name", Mandatory = true), DataMember(Name = "Name")] + public virtual string Name + { + get + { + return this._name; + } + set + { + if (this._name != value) + { + this.RaisePropertyChanging(); + this._name = value; + this.IsDirty = true; + this.RaisePropertyChanged("Name"); + } + } + } + + /// + /// Gets or sets the version of the umbraco item + /// + /// The version. + [Field] + [UmbracoInfo("version", DisplayName = "Version", Mandatory = true), DataMember(Name = "Version")] + public virtual string Version + { + get + { + return this._versionId; + } + protected set + { + if (this._versionId != value) + { + this.RaisePropertyChanging(); + this._versionId = value; + this.RaisePropertyChanged("Version"); + } + } + } + + /// + /// Gets or sets the ID of the parent node. + /// + /// The parent node id. + [Field] + [UmbracoInfo("parentID", DisplayName = "ParentId", Mandatory = true), DataMember(Name = "ParentId")] + public virtual int ParentNodeId + { + get + { + return this._parentId; + } + set + { + if (this._parentId != value) + { + this.RaisePropertyChanging(); + this._parentId = value; + this.RaisePropertyChanged("Version"); + } + } + } + + /// + /// Gets or sets the created date. + /// + /// The create date. + [Field] + [UmbracoInfo("createDate", DisplayName = "CreateDate"), DataMember(Name = "CreateDate")] + public virtual DateTime CreateDate { get; set; } + + /// + /// Gets or sets the sort order. + /// + /// The sort order. + [Field] + [UmbracoInfo("sortOrder", DisplayName = "SortOrder"), DataMember(Name = "SortOrder")] + public virtual int SortOrder { get; set; } + + /// + /// Gets or sets the last updated date of the current version + /// + /// The update date. + [Field] + [UmbracoInfo("updateDate", DisplayName = "UpdateDate"), DataMember(Name = "UpdateDate")] + public virtual DateTime UpdateDate { get; set; } + + /// + /// Gets or sets the level of this item in the content tree + /// + /// The level. + [Field] + [UmbracoInfo("level", DisplayName="Level"), DataMember(Name="Level")] + public virtual int Level { get; set; } + #endregion + + #region Parents and Children + /// + /// Gets the children of this DocType instance. + /// + /// The children of this DocType instance. + public AssociationTree Children + { + get + { + if (this._children == null) + { + this._children = this.Provider.LoadAssociation(this.Id); //tell the provider to create it + } + + return this._children; + } + } + + /// + /// Gets the children which are of the type TDocTypeBase. + /// + /// The DocType of the children desired. + /// An of the children + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] + protected AssociationTree ChildrenOfType() where TDocTypeBase : DocTypeBase, new() + { + return this.Provider.LoadAssociation(this.Children.Where(d => d is TDocTypeBase).Cast()); + } + + /// + /// Parent this instance. + /// + /// The type of the parent. + /// Null when at the root level, else the parent instance + /// If the type of the parent does not match the provided type + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] + public virtual TParent Parent() where TParent : DocTypeBase, new() + { + if (this._parentId == -1) + { + return null; + } + + return this.Provider.Load(this._parentId); + } + + /// + /// Retrieves the first matching ancestor of the current type + /// + /// + /// Provides similar functionality to the XPath method + /// + /// First ancestor matching type. Null if no match found + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] + public TDocType AncestorOrDefault() where TDocType : DocTypeBase + { + return this.AncestorOrDefault(t => true); //just a simple little true statement ;) + } + + /// + /// Retrieves the first matching ancestor of the current type and additional boolean function + /// + /// The type of the doc type. + /// Additional boolean operation to filter on + /// First ancestor matching type and function. Null if no match found + /// Func parameter required + public TDocType AncestorOrDefault(Func func) where TDocType : DocTypeBase + { + if (func == null) + { + throw new ArgumentNullException("func"); + } + + if (this._ancestors == null) + { + this._ancestors = this.Provider.LoadAncestors(this.Id); + } + + return this._ancestors.Where(a => a is TDocType).Cast().FirstOrDefault(func); + } + #endregion + + /// + /// Gets the umbraco user who created the item + /// + /// The creator. + public virtual User Creator + { + get + { + if (this._creator == null) + { + this._creator = new User(this._creatorID); + } + + return this._creator; + } + } + + /// + /// Gets the umbraco user who last edited the instance + /// + /// The writer. + public virtual User Writer + { + get + { + if (this._writer == null) + { + this._writer = new User(this._writerID); + } + + return this._writer; + } + } + + /// + /// Raises the property changing event. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] + protected virtual void RaisePropertyChanging() + { + if (this.PropertyChanging != null) + { + this.PropertyChanging(this, new PropertyChangingEventArgs(String.Empty)); + } + } + + /// + /// Raises the property changed event. + /// + /// The name of the changed property. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] + protected virtual void RaisePropertyChanged(string name) + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(name)); + } + } + + #region INotifyPropertyChanging Members + + /// + /// Occurs when a property value is changing. + /// + public event PropertyChangingEventHandler PropertyChanging; + + #endregion + + #region INotifyPropertyChanged Members + + /// + /// Occurs when a property value changes. + /// + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Exceptions.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Exceptions.cs new file mode 100644 index 0000000000..5d83367cff --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Exceptions.cs @@ -0,0 +1,128 @@ +using System; + +namespace umbraco.Linq.Core +{ + /// + /// Exception for when the provided class does not meet the expected class + /// + [global::System.Serializable] + public class DocTypeMissMatchException : ArgumentException + { + /// + /// Initializes a new instance of the class. + /// + /// The actual doc type alias. + /// The expcected doc type alias. + public DocTypeMissMatchException(string actual, string expected) : this(actual, expected, string.Empty) { } + /// + /// Initializes a new instance of the class. + /// + /// The actual doc type alias. + /// The expcected doc type alias. + /// Additional message information. + public DocTypeMissMatchException(string actual, string expected, string message) + : base(string.Format("DocTypeAlias provided did not match what was expected (provided: {0}, expected: {1}){2}{3}", actual, expected, Environment.NewLine, message)) + { + Expected = expected; + Actual = actual; + } + /// + /// Initializes a new instance of the class. + /// + /// The actual doc type alias. + /// The expcected doc type alias. + /// Additional message information. + /// The inner exception. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object[])")] + public DocTypeMissMatchException(string actual, string expected, string message, Exception innerException) + : base(string.Format("DocTypeAlias provided did not match what was expected (provided: {0}, expected: {1}){2}{3}", actual, expected, Environment.NewLine, message), innerException) + { + Expected = expected; + Actual = actual; + } + + /// + /// Initializes a new instance of the class. + /// + /// The that holds the serialized object data about the exception being thrown. + /// The that contains contextual information about the source or destination. + /// + /// The parameter is null. + /// + /// + /// The class name is null or is zero (0). + /// + protected DocTypeMissMatchException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) { } + + /// + /// Gets or sets the expected DocTypeAlias + /// + /// The expected DocTypeAlias. + public string Expected { get; set; } + /// + /// Gets or sets the actual DocTypeAlias + /// + /// The actual DocTypeAlias. + public string Actual { get; set; } + } + + /// + /// Exception raised when a field isn't meeting its mandatory requirement + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors"), global::System.Serializable] + public class MandatoryFailureException : Exception + { + /// + /// Initializes a new instance of the class. + /// + /// Name of the property that failed the mandatory check. + public MandatoryFailureException(string propertyName) : this(propertyName, string.Empty) { } + /// + /// Initializes a new instance of the class. + /// + /// Name of the property that failed the mandatory check. + /// Additional message information. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)")] + public MandatoryFailureException(string propertyName, string message) + : base(string.Format("The mandatory property \"{0}\" did not have a value.{1}{2}", propertyName, Environment.NewLine, message)) + { + PropertyName = propertyName; + } + /// + /// Initializes a new instance of the class. + /// + /// Name of the property that failed the mandatory check. + /// Additional message information. + /// The inner exception. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)")] + public MandatoryFailureException(string propertyName, string message, Exception innerException) + : base(string.Format("The mandatory property \"{0}\" did not have a value.{1}{2}", propertyName, Environment.NewLine, message), innerException) + { + PropertyName = propertyName; + } + /// + /// Initializes a new instance of the class. + /// + /// The that holds the serialized object data about the exception being thrown. + /// The that contains contextual information about the source or destination. + /// + /// The parameter is null. + /// + /// + /// The class name is null or is zero (0). + /// + protected MandatoryFailureException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) { } + + /// + /// Gets or sets the name of the property the exception was raised for. + /// + /// The name of the property. + public string PropertyName { get; set; } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/GlobalSuppressions.cs b/LinqToUmbraco/src/umbraco.Linq/Core/GlobalSuppressions.cs new file mode 100644 index 0000000000..6add7f8300 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/GlobalSuppressions.cs @@ -0,0 +1,26 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. +// +// To add a suppression to this file, right-click the message in the +// Error List, point to "Suppress Message(s)", and click +// "In Project Suppression File". +// You do not need to add suppressions to this file manually. + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "namespace", Target = "umbraco.Linq.Core")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "umbraco.Linq.Core.Node")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "namespace", Target = "umbraco.Linq.Core.Node")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "umbraco.Linq.Core.DocTypeMissMatchException")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object[])", Scope = "member", Target = "umbraco.Linq.Core.DocTypeMissMatchException.#.ctor(System.String,System.String,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "member", Target = "umbraco.Linq.Core.ReflectionAssistance.#GetumbracoInfoAttribute(System.Type)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "type", Target = "umbraco.Linq.Core.umbracoDataContext")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "type", Target = "umbraco.Linq.Core.umbracoDataProvider")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "umbraco.Linq.Core.umbracoDataProvider.#Load`1(System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "umbraco.Linq.Core.umbracoDataProvider.#LoadTree`1()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "type", Target = "umbraco.Linq.Core.umbracoInfoAttribute")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Scope = "type", Target = "umbraco.Linq.Core.Node.NodeAssociationTree`1")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "umbraco.Linq.Core.Node.NodeDataProvider.#LoadTree`1()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Scope = "type", Target = "umbraco.Linq.Core.Node.NodeTree`1")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "umbraco.Linq.Core.Node.NodeDataProvider.#Load`1(System.Int32)")] diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/ITree.cs b/LinqToUmbraco/src/umbraco.Linq/Core/ITree.cs new file mode 100644 index 0000000000..1dc516e710 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/ITree.cs @@ -0,0 +1,27 @@ + +namespace umbraco.Linq.Core +{ + /// + /// Base of an umbraco content tree + /// + public interface ITree + { + /// + /// Gets the Provider associated with this instance + /// + /// The provider. + umbracoDataProvider Provider { get; } + /// + /// Gets a value indicating whether this instance is read only. + /// + /// + /// true if this instance is read only; otherwise, false. + /// + bool IsReadOnly { get; } + + /// + /// Reloads the cache for the particular tree + /// + void ReloadCache(); + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeAssociationTree.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeAssociationTree.cs new file mode 100644 index 0000000000..b3cfe185a5 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeAssociationTree.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace umbraco.Linq.Core.Node +{ + /// + /// Represents a collection of TDocTypeBase retrieved from the umbraco XML cache which are direct children of a node + /// + /// The type of the doc type base. + public sealed class NodeAssociationTree : AssociationTree where TDocTypeBase : DocTypeBase, new() + { + private IEnumerable _nodes; + + internal NodeAssociationTree(IEnumerable nodes) + { + this._nodes = new List(); + this._nodes = nodes; + } + + /// + /// Initializes a new instance of the class for a particular tree section + /// + /// The parent node id to start from. + /// The NodeDataProvider to link the tree with. + public NodeAssociationTree(int parentNodeId, NodeDataProvider provider) + { + this.Provider = provider; + this.ParentNodeId = parentNodeId; + } + + /// + /// Gets the enumerator for this Tree collection + /// + /// + public override IEnumerator GetEnumerator() + { + if (this._nodes == null) //first access, otherwise it'd be cached + { + LoadNodes(); + } + return this._nodes.GetEnumerator(); + } + + private void LoadNodes() + { + var provider = this.Provider as NodeDataProvider; + + provider.CheckDisposed(); + + var rawNodes = provider.Xml.Descendants("node") + .Where(x => (int)x.Attribute("id") == this.ParentNodeId) + .Single() + .Elements("node") + ; + this._nodes = provider.DynamicNodeCreation(rawNodes).Cast(); //drop is back to the type which was asked for + } + + /// + /// Indicates that the NodeAssociationTree is ReadOnly + /// + /// + /// true + /// + public override bool IsReadOnly + { + get + { + return true; + } + } + + /// + /// Gets or sets the DataProvider associated with this Tree + /// + /// The provider. + public override umbracoDataProvider Provider { get; protected set; } + + public override void ReloadCache() + { + this.LoadNodes(); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs new file mode 100644 index 0000000000..8544835a30 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeDataProvider.cs @@ -0,0 +1,311 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Linq.Expressions; +using System.IO; +using System.Xml.Linq; +using System.Xml.Schema; + +namespace umbraco.Linq.Core.Node +{ + /// + /// Data Provider for LINQ to umbraco via umbraco ndoes + /// + /// + /// This class provides a data access model for the umbraco XML cache. + /// It is responsible for the access to the XML and construction of nodes from it. + /// + /// The is capable of reading the XML cache from either the path provided in the umbraco settings or from a specified location on the file system. + /// + public sealed class NodeDataProvider : umbracoDataProvider + { + private string _xmlPath; + private Dictionary _trees; + private bool _enforceSchemaValidation; + private XDocument _xml; + private const string UMBRACO_XSD_PATH = "umbraco.Linq.Core.Node.umbracoConfig.xsd"; + private Dictionary _knownTypes; + + internal XDocument Xml + { + get + { + if (this._xml == null) + { + this._xml = XDocument.Load(this._xmlPath); + + if (this._enforceSchemaValidation) + { + XmlSchemaSet schemas = new XmlSchemaSet(); + //read the resorce for the XSD to validate against + schemas.Add("", System.Xml.XmlReader.Create(this.GetType().Assembly.GetManifestResourceStream(UMBRACO_XSD_PATH))); + + //we'll have a list of all validation exceptions to put them to the screen + List exList = new List(); + + //some funky in-line event handler. Lambda loving goodness ;) + this._xml.Validate(schemas, (o, e) => { exList.Add(e.Exception); }); + + if (exList.Count > 0) + { + //dump out the exception list + StringBuilder sb = new StringBuilder(); + sb.AppendLine("The following validation errors occuring with the XML:"); + foreach (var item in exList) + { + sb.AppendLine(" * " + item.Message + " - " + item.StackTrace); + } + throw new XmlSchemaException(sb.ToString()); + } + } + } + + return this._xml; //cache the XML in memory to increase performance and force the disposable pattern + } + } + + private void Init(string xmlPath) + { + if (string.IsNullOrEmpty(xmlPath)) + { + throw new ArgumentNullException("xmlPath"); + } + + if (!File.Exists(xmlPath)) + { + throw new FileNotFoundException("The XML used by the provider must exist", xmlPath); + } + this._xmlPath = xmlPath; + + this._trees = new Dictionary(); + } + + /// + /// Initializes a new instance of the class using umbraco settings as XML path + /// + public NodeDataProvider() + : this(System.Web.HttpContext.Current.Server.MapPath(umbraco.GlobalSettings.Path)) + { + } + + /// + /// Initializes a new instance of the class + /// + /// + /// This constructor is ideal for unit testing as it allows for the XML to be located anywhere + /// + /// The path of the umbraco XML + public NodeDataProvider(string xmlPath) + : this(xmlPath, false) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The XML path. + /// if set to true when the XML document is accessed validation against the umbraco XSD will be done. + /// Thrown when the xmlPath is null + /// Thrown when the xmlPath does not resolve to a physical file + public NodeDataProvider(string xmlPath, bool enforceValidation) + { + this.Init(xmlPath); + this._enforceSchemaValidation = enforceValidation; + } + + #region IDisposable Members + + private bool _disposed; + + /// + /// Releases unmanaged and - optionally - managed resources + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected internal override void Dispose(bool disposing) + { + if (!this._disposed && disposing) + { + this._xmlPath = null; + + this._disposed = true; + } + } + + internal void CheckDisposed() + { + if (this._disposed) + { + throw new ObjectDisposedException(null); + } + } + + #endregion + + /// + /// Gets the name of the provider + /// + /// The name of the provider. + public override string Name + { + get + { + return "NodeDataProvider"; + } + } + + /// + /// Loads the tree with the relivent DocTypes from the XML + /// + /// The type of the DocType to load. + /// representation of the content tree + /// When the data provider has been disposed of + public override Tree LoadTree() + { + CheckDisposed(); + + var attr = ReflectionAssistance.GetumbracoInfoAttribute(typeof(TDocType)); + + if (!this._trees.ContainsKey(attr)) + { + SetupNodeTree(attr); + } + + return (NodeTree)this._trees[attr]; + } + + internal void SetupNodeTree(UmbracoInfoAttribute attr) where TDocType : DocTypeBase, new() + { + var tree = new NodeTree(this); + if (!this._trees.ContainsKey(attr)) + { + this._trees.Add(attr, tree); //cache so it's faster to get next time + } + else + { + this._trees[attr] = tree; + } + } + + /// + /// Loads the specified id. + /// + /// The type of the doc type. + /// The id. + /// + /// If the type of the parent does not match the provided type + /// No node found matching the provided ID for the parent + /// When the data provider has been disposed of + public override TDocType Load(int id) + { + CheckDisposed(); + + var parentXml = this.Xml.Descendants("node").SingleOrDefault(d => (int)d.Attribute("id") == id); + + if (!ReflectionAssistance.CompareByAlias(typeof(TDocType), parentXml)) + { + throw new DocTypeMissMatchException((string)parentXml.Attribute("nodeTypeAlias"), ReflectionAssistance.GetumbracoInfoAttribute(typeof(TDocType)).Alias); + } + + if (parentXml == null) //really shouldn't happen! + { + throw new ArgumentException("Parent ID \"" + id + "\" cannot be found in the loaded XML. Ensure that the umbracoDataContext is being disposed of once it is no longer needed"); + } + + var parent = new TDocType(); + parent.LoadFromXml(parentXml); + + return parent; + } + + /// + /// Loads the associated (children) nodes with the relivent DocTypes + /// + /// The parent node id. + /// + /// When the data provider has been disposed of + public override AssociationTree LoadAssociation(int parentNodeId) + { + CheckDisposed(); + + NodeAssociationTree associationTree = new NodeAssociationTree(parentNodeId, this); + + return associationTree; + } + + + /// + /// Loads the associated nodes with the relivent DocTypes + /// + /// The type of the DocType to load. + /// The nodes. + /// + /// When the data provider has been disposed of + public override AssociationTree LoadAssociation(IEnumerable nodes) + { + CheckDisposed(); + + return new NodeAssociationTree(nodes); + } + + /// + /// Loads the ancestors for a node + /// + /// The start node id. + /// + /// When the data provider has been disposed of + public override IEnumerable LoadAncestors(int startNodeId) + { + CheckDisposed(); + + var startElement = this.Xml.Descendants("node").Single(x => (int)x.Attribute("id") == startNodeId); + var ancestorElements = startElement.Ancestors("node"); + + IEnumerable ancestors = DynamicNodeCreation(ancestorElements); + + return ancestors; + } + + /// + /// Creates a collection of nodes with the type specified from the XML + /// + /// The elements. + /// Collecton of .NET types from the XML + internal IEnumerable DynamicNodeCreation(IEnumerable elements) + { + // TODO: investigate this method for performance bottlenecks + // TODO: dataContext knows the types, maybe can load from there? + List ancestors = new List(); + + foreach (var ancestor in elements) + { + var alias = (string)ancestor.Attribute("nodeTypeAlias"); + var t = KnownTypes[alias]; + var instaceOfT = (DocTypeBase)Activator.CreateInstance(t); //create an instance of the type and down-cast so we can use it + instaceOfT.LoadFromXml(ancestor); + instaceOfT.Provider = this; + ancestors.Add(instaceOfT); + yield return instaceOfT; + } + + //return ancestors; + } + + //Will this cause a problem with trust levels...? + internal Dictionary KnownTypes + { + get + { + if (this._knownTypes == null) + { + this._knownTypes = (from a in AppDomain.CurrentDomain.GetAssemblies() + from t in a.GetTypes() + where t.GetCustomAttributes(typeof(DocTypeAttribute), true).Length == 1 + select t).ToDictionary(k => ((UmbracoInfoAttribute)k.GetCustomAttributes(typeof(UmbracoInfoAttribute), true)[0]).Alias); + } + + return this._knownTypes; + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeTree.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeTree.cs new file mode 100644 index 0000000000..f58d6bb8f6 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Node/NodeTree.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace umbraco.Linq.Core.Node +{ + /// + /// Represents a collection of TDocTypeBase retrieved from the umbraco XML cache + /// + /// The type of the doc type base. + public sealed class NodeTree : Tree where TDocTypeBase : DocTypeBase, new() + { + private NodeDataProvider _provider; + + private List _nodes; + + internal NodeTree(NodeDataProvider provider) + { + this._provider = provider; + } + + /// + /// Gets or sets the provider. + /// + /// The provider. + public override umbracoDataProvider Provider + { + get + { + return this._provider; + } + protected set + { + var nodeProvider = value as NodeDataProvider; + if (nodeProvider == null) + { + throw new ArgumentException("Value must be of type NodeDataProvider"); + } + this._provider = nodeProvider; + } + } + + /// + /// Indicates that the NodeTree is ReadOnly + /// + /// + /// true + /// + public override bool IsReadOnly + { + get + { + return true; + } + } + + /// + /// Gets the enumerator. + /// + /// + public override IEnumerator GetEnumerator() + { + if (this._nodes == null) + { + this._nodes = new List(); + var rawNodes = this._provider.Xml.Descendants("node").Where(x => ReflectionAssistance.CompareByAlias(typeof(TDocTypeBase), x)); + + foreach (XElement n in rawNodes) + { + var dt = new TDocTypeBase(); + dt.LoadFromXml(n); + + dt.IsDirty = false; + dt.Provider = this._provider; + + this._nodes.Add(dt); + } + } + return this._nodes.GetEnumerator(); + } + + /// + /// Reloads the cache for the particular NodeTree + /// + public override void ReloadCache() + { + this._provider.CheckDisposed(); + + var attr = ReflectionAssistance.GetumbracoInfoAttribute(typeof(TDocTypeBase)); + this._provider.SetupNodeTree(attr); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Properties/AssemblyInfo.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..2e78b3fe48 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Core")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("Core")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("umbraco.Linq.Core.Tests")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/ReflectionAssistance.cs b/LinqToUmbraco/src/umbraco.Linq/Core/ReflectionAssistance.cs new file mode 100644 index 0000000000..9d9fc371da --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/ReflectionAssistance.cs @@ -0,0 +1,54 @@ +using System; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; + +namespace umbraco.Linq.Core +{ + /// + /// Class containing helpers when doing reflection against nodes + /// + public sealed class ReflectionAssistance + { + private ReflectionAssistance() { } + + /// + /// Prebuilt function for getting the custom properites of the class + /// + /// This is a Lambda function which will return all the properties of the current class which are custom DocType properties + internal static Func CustomDocTypeProperties = p => p.GetCustomAttributes(typeof(UmbracoInfoAttribute), false).Count() != 0 && p.GetCustomAttributes(typeof(PropertyAttribute), false).Count() != 0; + + /// + /// Prebuild function for getting the mandatory properites of the class + /// + /// This is a Lambda function which will return all the properties of the current class which are custom DocType properties and mandatory + internal static Func MandatoryDocTypeProperties = p => p.GetCustomAttributes(typeof(UmbracoInfoAttribute), false).Count() != 0 && ((UmbracoInfoAttribute)p.GetCustomAttributes(typeof(UmbracoInfoAttribute), false)[0]).Mandatory; + + /// + /// Compares a .NET type to an Xml representation + /// + internal static Func CompareByAlias = (t, x) => (string)x.Attribute("nodeTypeAlias") == ReflectionAssistance.GetumbracoInfoAttribute(t).Alias; + + /// + /// Get the for a object + /// + /// The methodInfo to get the for. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco")] + public static UmbracoInfoAttribute GetumbracoInfoAttribute(MemberInfo member) + { + return member.GetCustomAttributes(typeof(UmbracoInfoAttribute), true).Cast().SingleOrDefault(); + } + + /// + /// Get the for a type + /// + /// The type to get the for. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] + public static UmbracoInfoAttribute GetumbracoInfoAttribute(Type type) + { + return type.GetCustomAttributes(typeof(UmbracoInfoAttribute), true).Cast().SingleOrDefault(); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Switch.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Switch.cs new file mode 100644 index 0000000000..154e4f0b99 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Switch.cs @@ -0,0 +1,109 @@ +using System; + +namespace umbraco.Linq.Core +{ + /// + /// Typed switch implementation from Bart De Smet: http://community.bartdesmet.net/blogs/bart/archive/2008/03/30/a-functional-c-type-switch.aspx + /// + public class Switch + { + /// + /// Initializes a new instance of the class. + /// + /// The o. + public Switch(object o) + { + Obj = o; + } + + /// + /// Gets or sets the object being operated against + /// + /// The obj. + public object Obj { get; private set; } + + /// + /// Case statement + /// + /// Type of object + /// Action method to execute for case evaluation + /// + public Switch Case(Action a) + { + return Case(o => true, a, false); + } + + /// + /// Case statement + /// + /// Type of object + /// Action method to execute for case evaluation + /// if set to true fall through to next case statement. + /// + public Switch Case(Action a, bool fallThrough) + { + return Case(o => true, a, fallThrough); + } + + /// + /// Case statement + /// + /// Type of object + /// The funcation to eveluate against to object. + /// Action method to execute for case evaluation + /// + public Switch Case(Func c, Action a) + { + return Case(c, a, false); + } + + /// + /// Case statement + /// + /// Type of object + /// The funcation to eveluate against to object. + /// Action method to execute for case evaluation + /// if set to true fall through to next case statement. + /// + public Switch Case(Func c, Action a, bool fallThrough) + { + if (this == null) + { + return null; + } + else + { + if (this.Obj is T) + { + T t = (T)this.Obj; + if (c(t)) + { + a(t); + return fallThrough ? this : null; + } + } + } + + return this; + } + + /// + /// Defaults case + /// + /// Type of object + /// Action to perform + /// + public Switch Default(Action a) + { + if (this == null) + { + return null; + } + else + { + a((T)this.Obj); + return this; + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/Tree.cs b/LinqToUmbraco/src/umbraco.Linq/Core/Tree.cs new file mode 100644 index 0000000000..fe7381c958 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/Tree.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Collections; +using System.ComponentModel; +using System.Linq.Expressions; +using System.Xml.Linq; + +namespace umbraco.Linq.Core +{ + /// + /// Represents a collection within DataProvider of a DocType + /// + /// + /// Similar to the implementation of , + /// providing a single collection which represents all instances of the given type within the DataProvider. + /// + /// Implementers of this type will need to provide a manner of retrieving the TDocType from the DataProvider + /// + /// The type of the DocType. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] + public abstract class Tree : ITree, IEnumerable, IEnumerable + where TDocType : DocTypeBase, new() + { + #region ITree Members + + /// + /// Gets the Provider associated with this instance + /// + /// The provider. + public abstract umbracoDataProvider Provider { get; protected set; } + + /// + /// Gets a value indicating whether this instance is read only. The collection is not ReadOnly by default + /// + /// + /// false to indicate that this collection isn't read-only + /// + public virtual bool IsReadOnly + { + get + { + return false; + } + } + + public abstract void ReloadCache(); + + #endregion + + #region IEnumerable Members + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// + public abstract IEnumerator GetEnumerator(); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + + #endregion + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/UmbracoDataContext.cs b/LinqToUmbraco/src/umbraco.Linq/Core/UmbracoDataContext.cs new file mode 100644 index 0000000000..83d4b53dbe --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/UmbracoDataContext.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using umbraco.Linq.Core.Node; + +namespace umbraco.Linq.Core +{ + /// + /// The umbracoDataContext which handles the interaction with an + /// + public abstract class umbracoDataContext : IDisposable + { + #region Privates + private umbracoDataProvider _dataProvider; + #endregion + + /// + /// Loads the tree of umbraco items. + /// + /// The type of the DocTypeBase. + /// Collection of umbraco items + /// If the DataContext has been disposed of + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] + protected Tree LoadTree() where TDocTypeBase : DocTypeBase, new() + { + CheckDisposed(); + return this._dataProvider.LoadTree(); + } + + /// + /// Gets the data provider. + /// + /// The data provider. + public umbracoDataProvider DataProvider + { + get + { + return this._dataProvider; + } + } + + #region Constructors + + /// + /// Initializes a new instance of the class, using a data provider with the connection string from the umbraco config + /// + protected umbracoDataContext() : this(new NodeDataProvider()) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The data provider to use within the DataContext. + protected umbracoDataContext(umbracoDataProvider dataProvider) + { + this._dataProvider = dataProvider; + } + + #endregion + + #region IDisposable Members + + private bool _disposed; + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases unmanaged and - optionally - managed resources + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (!this._disposed && disposing) + { + if (this._dataProvider != null) + { + this._dataProvider.Dispose(true); + } + + this._disposed = true; + } + } + + private void CheckDisposed() + { + if (this._disposed) + { + throw new ObjectDisposedException(null); + } + } + + #endregion + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/UmbracoDataProvider.cs b/LinqToUmbraco/src/umbraco.Linq/Core/UmbracoDataProvider.cs new file mode 100644 index 0000000000..479a0083f4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/UmbracoDataProvider.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Linq.Expressions; + +namespace umbraco.Linq.Core +{ + /// + /// Provides the methods required for a data access model within the LINQ to umbraco project + /// + /// + /// This base class is used when defining how a DataProvider operates against a data source (such as the umbraco.config). + /// + /// It provides abstractions for all the useful operations of the DataProvider + /// + public abstract class umbracoDataProvider : IDisposable + { + /// + /// Gets the name of the provider + /// + /// The name of the provider. + public abstract string Name { get; } + + /// + /// Loads the tree with the relivent DocTypes + /// + /// The type of the DocType to load. + /// + public abstract Tree LoadTree() where TDocType : DocTypeBase, new(); + + /// + /// Loads the associated nodes with the relivent DocTypes + /// + /// The parent node id. + /// + public abstract AssociationTree LoadAssociation(int parentNodeId); + + /// + /// Loads the associated nodes with the relivent DocTypes + /// + /// The type of the DocType to load. + /// The nodes. + /// + public abstract AssociationTree LoadAssociation(IEnumerable nodes) where TDocType : DocTypeBase, new(); + + /// + /// Loads the specified id. + /// + /// The type of the doc type. + /// The id. + /// + public abstract TDocType Load(int id) where TDocType : DocTypeBase, new(); + + /// + /// Loads the ancestors. + /// + /// The start node id. + /// + public abstract IEnumerable LoadAncestors(int startNodeId); + + #region IDisposable Members + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases unmanaged and - optionally - managed resources + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")] + protected internal virtual void Dispose(bool disposing) + { + } + + #endregion + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj b/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj new file mode 100644 index 0000000000..396f346046 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj @@ -0,0 +1,103 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {31CAEC36-0C3D-4D69-B092-84866811EA07} + Library + Properties + umbraco.Linq.Core + umbraco.Linq.Core + v3.5 + 512 + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\umbraco.Linq.Core.xml + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\Debug - Fixed Version\ + DEBUG;TRACE + bin\Debug\Umbraco.Linq.Core.XML + full + AnyCPU + true + GlobalSuppressions.cs + prompt + + + + + 3.5 + + + 3.0 + + + + + 3.5 + + + + + Properties\SolutionInfo.cs + + + + + + + + + + + + + + + + + + + + Node\UmbracoConfig.xsd + + + + + + {E469A9CE-1BEC-423F-AC44-713CD72457EA} + umbraco.businesslogic + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj.vspscc b/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/Core/umbraco.Linq.Core.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal Installer/DTMetal Installer.vdproj b/LinqToUmbraco/src/umbraco.Linq/DTMetal Installer/DTMetal Installer.vdproj new file mode 100644 index 0000000000..33744a1e62 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal Installer/DTMetal Installer.vdproj @@ -0,0 +1,3165 @@ +"DeployProject" +{ +"VSVersion" = "3:800" +"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" +"IsWebType" = "8:FALSE" +"ProjectName" = "8:DTMetal Installer" +"LanguageId" = "3:1033" +"CodePage" = "3:1252" +"UILanguageId" = "3:1033" +"SccProjectName" = "8:SAK" +"SccLocalPath" = "8:SAK" +"SccAuxPath" = "8:SAK" +"SccProvider" = "8:SAK" + "Hierarchy" + { + "Entry" + { + "MsmKey" = "8:_0DBC69ED86E489240A48D6BB5AEC193C" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_0DBC69ED86E489240A48D6BB5AEC193C" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + "OwnerKey" = "8:_AD9348DC4493A66504DB02526E419114" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + "OwnerKey" = "8:_5DAD23E86B2CB7C44E2EE68DE2A47591" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + "OwnerKey" = "8:_AC86EBB7EFACB032EBD5C428EDE600A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + "OwnerKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + "OwnerKey" = "8:_F0A1398309CD846D7B9EF833FDA170D4" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_18974CA0323081B05C02A067773C66BA" + "OwnerKey" = "8:_7AD29F9D90E7E4F304805783AA91CFA3" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1F50885CEA0B84CE97664D528172DCFE" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1F50885CEA0B84CE97664D528172DCFE" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_21FB5B4A9F560AB80F430D06AE334DDF" + "OwnerKey" = "8:_0DBC69ED86E489240A48D6BB5AEC193C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "OwnerKey" = "8:_5DAD23E86B2CB7C44E2EE68DE2A47591" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "OwnerKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_25E31B9A8A4FA965D5000BB7E406C597" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_25E31B9A8A4FA965D5000BB7E406C597" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_25E31B9A8A4FA965D5000BB7E406C597" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_25E31B9A8A4FA965D5000BB7E406C597" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_304342044AC9601D481E8C63EC728F70" + "OwnerKey" = "8:_AD9348DC4493A66504DB02526E419114" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_304342044AC9601D481E8C63EC728F70" + "OwnerKey" = "8:_AC86EBB7EFACB032EBD5C428EDE600A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_304342044AC9601D481E8C63EC728F70" + "OwnerKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_304342044AC9601D481E8C63EC728F70" + "OwnerKey" = "8:_F0A1398309CD846D7B9EF833FDA170D4" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "OwnerKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "OwnerKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "OwnerKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "OwnerKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "OwnerKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "OwnerKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "OwnerKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "OwnerKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "OwnerKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_45DB6D2FFD04A5ED29F47F95435F56F3" + "OwnerKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_56613DAEE3C3F18649E5B0A5C4566517" + "OwnerKey" = "8:_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_56613DAEE3C3F18649E5B0A5C4566517" + "OwnerKey" = "8:_69D16AE7E5E1E71B1BC0C4500EDE8476" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_56613DAEE3C3F18649E5B0A5C4566517" + "OwnerKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_5DAD23E86B2CB7C44E2EE68DE2A47591" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_69D16AE7E5E1E71B1BC0C4500EDE8476" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7AD29F9D90E7E4F304805783AA91CFA3" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7AD29F9D90E7E4F304805783AA91CFA3" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7AD29F9D90E7E4F304805783AA91CFA3" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7AD29F9D90E7E4F304805783AA91CFA3" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7AD29F9D90E7E4F304805783AA91CFA3" + "OwnerKey" = "8:_1F50885CEA0B84CE97664D528172DCFE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7AD29F9D90E7E4F304805783AA91CFA3" + "OwnerKey" = "8:_89C47BE8196A61202AC166EE517FC092" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7CB5C3513243EE61087C97DB7E7EB562" + "OwnerKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7CB5C3513243EE61087C97DB7E7EB562" + "OwnerKey" = "8:_AC86EBB7EFACB032EBD5C428EDE600A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7CB5C3513243EE61087C97DB7E7EB562" + "OwnerKey" = "8:_F0A1398309CD846D7B9EF833FDA170D4" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_89C47BE8196A61202AC166EE517FC092" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_89C47BE8196A61202AC166EE517FC092" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_89C47BE8196A61202AC166EE517FC092" + "OwnerKey" = "8:_1F50885CEA0B84CE97664D528172DCFE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_91B110ECD9B3A3EED8C259AA69206910" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_91B110ECD9B3A3EED8C259AA69206910" + "OwnerKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_91B110ECD9B3A3EED8C259AA69206910" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_91B110ECD9B3A3EED8C259AA69206910" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_96FE95C5ED97685D8A35E945EEBFF16A" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_96FE95C5ED97685D8A35E945EEBFF16A" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_96FE95C5ED97685D8A35E945EEBFF16A" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_96FE95C5ED97685D8A35E945EEBFF16A" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "OwnerKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_AA37555C7C0469F8074E8EADC0B775B1" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_AC86EBB7EFACB032EBD5C428EDE600A9" + "OwnerKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_AD9348DC4493A66504DB02526E419114" + "OwnerKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_AD9348DC4493A66504DB02526E419114" + "OwnerKey" = "8:_AC86EBB7EFACB032EBD5C428EDE600A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_AD9348DC4493A66504DB02526E419114" + "OwnerKey" = "8:_F0A1398309CD846D7B9EF833FDA170D4" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_AEB6A1C9040B405D879808139EB0D378" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_B914C40F58C09277BB8493610F624BA7" + "OwnerKey" = "8:_1F50885CEA0B84CE97664D528172DCFE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_BFDA41D2B373F97ADE98202496895FD8" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_BFDA41D2B373F97ADE98202496895FD8" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_BFDA41D2B373F97ADE98202496895FD8" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_BFDA41D2B373F97ADE98202496895FD8" + "OwnerKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "OwnerKey" = "8:_25E31B9A8A4FA965D5000BB7E406C597" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "OwnerKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "OwnerKey" = "8:_0DBC69ED86E489240A48D6BB5AEC193C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "OwnerKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_F0A1398309CD846D7B9EF833FDA170D4" + "OwnerKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_F0A1398309CD846D7B9EF833FDA170D4" + "OwnerKey" = "8:_AC86EBB7EFACB032EBD5C428EDE600A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "OwnerKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "OwnerKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_91B110ECD9B3A3EED8C259AA69206910" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_D04C94D3BAE248ADBB65968A9C8BAD7C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_5DAD23E86B2CB7C44E2EE68DE2A47591" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_69D16AE7E5E1E71B1BC0C4500EDE8476" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_AA37555C7C0469F8074E8EADC0B775B1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_22887730B62E97CB0C6E0169030D63FF" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_A30C1F9054564E5692E22D1D82E217A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_25E31B9A8A4FA965D5000BB7E406C597" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_96FE95C5ED97685D8A35E945EEBFF16A" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_885E4C7F15BDEEC36B67AA9563BB2B51" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_EC3894ACAC9518C25134898C6B0C084B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_A7593823FCCBA8A5CAD30AA20291CB19" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_32AE725CC2E4AC9FE49EB2605898BB66" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_346312464B96ED5A061BFE1ADA11045A" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_BFDA41D2B373F97ADE98202496895FD8" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_250AEA8A0EFC212367261856B7876F48" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_1F50885CEA0B84CE97664D528172DCFE" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_89C47BE8196A61202AC166EE517FC092" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_7AD29F9D90E7E4F304805783AA91CFA3" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_0DBC69ED86E489240A48D6BB5AEC193C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_E67BBC8865F3231DBE18645E50209C79" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_6D30E9F6F22443EAB03C704C2A95705C" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_AC86EBB7EFACB032EBD5C428EDE600A9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_F0A1398309CD846D7B9EF833FDA170D4" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_AD9348DC4493A66504DB02526E419114" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_56613DAEE3C3F18649E5B0A5C4566517" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_304342044AC9601D481E8C63EC728F70" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_7CB5C3513243EE61087C97DB7E7EB562" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug\\DTMetal Installer.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.3.5.SP1" + { + "Name" = "8:.NET Framework 3.5 SP1" + "ProductCode" = "8:Microsoft.Net.Framework.3.5.SP1" + } + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1" + { + "Name" = "8:Windows Installer 3.1" + "ProductCode" = "8:Microsoft.Windows.Installer.3.1" + } + } + } + } + "Debug - Fixed Version" + { + "DisplayName" = "8:Debug - Fixed Version" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug - Fixed Version\\DTMetal Installer.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.3.5.SP1" + { + "Name" = "8:.NET Framework 3.5 SP1" + "ProductCode" = "8:Microsoft.Net.Framework.3.5.SP1" + } + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1" + { + "Name" = "8:Windows Installer 3.1" + "ProductCode" = "8:Microsoft.Windows.Installer.3.1" + } + } + } + } + "Release" + { + "DisplayName" = "8:Release" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:TRUE" + "OutputFilename" = "8:Release\\DTMetal Installer.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.3.5.SP1" + { + "Name" = "8:.NET Framework 3.5 SP1" + "ProductCode" = "8:Microsoft.Net.Framework.3.5.SP1" + } + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1" + { + "Name" = "8:Windows Installer 3.1" + "ProductCode" = "8:Microsoft.Windows.Installer.3.1" + } + } + } + } + } + "Deployable" + { + "CustomAction" + { + "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_9504839B6F01461F9C3D4E1F22631EDA" + { + "Name" = "8:Primary output from DTMetal.CodeBuilder (Active)" + "Condition" = "8:" + "Object" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "FileType" = "3:1" + "InstallAction" = "3:1" + "Arguments" = "8:" + "EntryPoint" = "8:" + "Sequence" = "3:1" + "Identifier" = "8:_03571BDC_087D_4D70_B37D_0BF0788B9FD1" + "InstallerClass" = "11:TRUE" + "CustomActionData" = "8:/TargetDir=\"[TARGETDIR]\\\"" + } + "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_A1F955FBDFC343CB88E8DB55C1E5A1D1" + { + "Name" = "8:Primary output from DTMetal.CodeBuilder (Active)" + "Condition" = "8:" + "Object" = "8:_B13BAC326D99486C99A5569F3BC4AC9C" + "FileType" = "3:1" + "InstallAction" = "3:4" + "Arguments" = "8:" + "EntryPoint" = "8:" + "Sequence" = "3:1" + "Identifier" = "8:_02E35048_B81F_46FF_9030_97F9CBD0A495" + "InstallerClass" = "11:TRUE" + "CustomActionData" = "8:/TargetDir=\"[TARGETDIR]\\\"" + } + } + "DefaultFeature" + { + "Name" = "8:DefaultFeature" + "Title" = "8:" + "Description" = "8:" + } + "ExternalPersistence" + { + "LaunchCondition" + { + "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_1C73DD266B904336BCC6591DACFD7BB2" + { + "Name" = "8:.NET Framework" + "Message" = "8:[VSDNETMSG]" + "Version" = "8:3.5.30729" + "AllowLaterVersions" = "11:FALSE" + "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=76617" + } + } + } + "File" + { + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_0DBC69ED86E489240A48D6BB5AEC193C" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_0DBC69ED86E489240A48D6BB5AEC193C" + { + "Name" = "8:EnvDTE80.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:EnvDTE80.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_73B0C616A8BB4F9C8EAA121307B00A0E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:umbraco.DataLayer, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_1345F0C5CA8CA7CDCE26FBA2F8DCA740" + { + "Name" = "8:umbraco.DataLayer.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:umbraco.DataLayer.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_18974CA0323081B05C02A067773C66BA" + { + "SourcePath" = "8:vslangproj.olb" + "TargetName" = "8:vslangproj.olb" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_1F50885CEA0B84CE97664D528172DCFE" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:VSLangProj80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_1F50885CEA0B84CE97664D528172DCFE" + { + "Name" = "8:VSLangProj80.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:VSLangProj80.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_73B0C616A8BB4F9C8EAA121307B00A0E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_21FB5B4A9F560AB80F430D06AE334DDF" + { + "SourcePath" = "8:dte80.olb" + "TargetName" = "8:dte80.olb" + "Tag" = "8:" + "Folder" = "8:_73B0C616A8BB4F9C8EAA121307B00A0E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_22887730B62E97CB0C6E0169030D63FF" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Umbraco.Linq.DTMetal.CodeBuilder, Version=0.0.1.35131, Culture=neutral, PublicKeyToken=a1619d9c35575289, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_22887730B62E97CB0C6E0169030D63FF" + { + "Name" = "8:Umbraco.Linq.DTMetal.CodeBuilder.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Umbraco.Linq.DTMetal.CodeBuilder.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_250AEA8A0EFC212367261856B7876F48" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_250AEA8A0EFC212367261856B7876F48" + { + "Name" = "8:Microsoft.VisualStudio.OLE.Interop.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.OLE.Interop.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_25E31B9A8A4FA965D5000BB7E406C597" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TemplateWizardInterface, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_25E31B9A8A4FA965D5000BB7E406C597" + { + "Name" = "8:Microsoft.VisualStudio.TemplateWizardInterface.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.TemplateWizardInterface.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_304342044AC9601D481E8C63EC728F70" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:interfaces, Version=1.0.3317.32686, Culture=neutral, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_304342044AC9601D481E8C63EC728F70" + { + "Name" = "8:interfaces.DLL" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:interfaces.DLL" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_32AE725CC2E4AC9FE49EB2605898BB66" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_32AE725CC2E4AC9FE49EB2605898BB66" + { + "Name" = "8:Microsoft.VisualStudio.Shell.Interop.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_346312464B96ED5A061BFE1ADA11045A" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_346312464B96ED5A061BFE1ADA11045A" + { + "Name" = "8:Microsoft.VisualStudio.TextManager.Interop.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.TextManager.Interop.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_45DB6D2FFD04A5ED29F47F95435F56F3" + { + "SourcePath" = "8:dte80a.olb" + "TargetName" = "8:dte80a.olb" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_56613DAEE3C3F18649E5B0A5C4566517" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.ApplicationBlocks.Data, Version=1.0.1559.20655, Culture=neutral" + "ScatterAssemblies" + { + "_56613DAEE3C3F18649E5B0A5C4566517" + { + "Name" = "8:Microsoft.ApplicationBlocks.Data.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.ApplicationBlocks.Data.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5DAD23E86B2CB7C44E2EE68DE2A47591" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Umbraco.Linq.DTMetal.Engine, Version=0.0.1.35133, Culture=neutral, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_5DAD23E86B2CB7C44E2EE68DE2A47591" + { + "Name" = "8:Umbraco.Linq.DTMetal.Engine.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Umbraco.Linq.DTMetal.Engine.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_69D16AE7E5E1E71B1BC0C4500EDE8476" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:umbraco.DataLayer, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_69D16AE7E5E1E71B1BC0C4500EDE8476" + { + "Name" = "8:umbraco.DataLayer.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:umbraco.DataLayer.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_7AD29F9D90E7E4F304805783AA91CFA3" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:VSLangProj, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_7AD29F9D90E7E4F304805783AA91CFA3" + { + "Name" = "8:VSLangProj.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:VSLangProj.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_7CB5C3513243EE61087C97DB7E7EB562" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_7CB5C3513243EE61087C97DB7E7EB562" + { + "Name" = "8:System.Web.Extensions.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Web.Extensions.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_885E4C7F15BDEEC36B67AA9563BB2B51" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_885E4C7F15BDEEC36B67AA9563BB2B51" + { + "Name" = "8:Microsoft.VisualStudio.Shell.9.0.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.Shell.9.0.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_89C47BE8196A61202AC166EE517FC092" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:VSLangProj2, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_89C47BE8196A61202AC166EE517FC092" + { + "Name" = "8:VSLangProj2.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:VSLangProj2.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_73B0C616A8BB4F9C8EAA121307B00A0E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_91B110ECD9B3A3EED8C259AA69206910" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.MSXML, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_91B110ECD9B3A3EED8C259AA69206910" + { + "Name" = "8:Microsoft.MSXML.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.MSXML.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_96FE95C5ED97685D8A35E945EEBFF16A" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Designer.Interfaces, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_96FE95C5ED97685D8A35E945EEBFF16A" + { + "Name" = "8:Microsoft.VisualStudio.Designer.Interfaces.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.Designer.Interfaces.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A7593823FCCBA8A5CAD30AA20291CB19" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_A7593823FCCBA8A5CAD30AA20291CB19" + { + "Name" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_AA37555C7C0469F8074E8EADC0B775B1" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.ApplicationBlocks.Data, Version=1.0.1559.20655, Culture=neutral" + "ScatterAssemblies" + { + "_AA37555C7C0469F8074E8EADC0B775B1" + { + "Name" = "8:Microsoft.ApplicationBlocks.Data.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.ApplicationBlocks.Data.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_AC86EBB7EFACB032EBD5C428EDE600A9" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:umbraco, Version=1.0.3317.32692, Culture=neutral, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_AC86EBB7EFACB032EBD5C428EDE600A9" + { + "Name" = "8:umbraco.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:umbraco.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_AD9348DC4493A66504DB02526E419114" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:businesslogic, Version=1.0.3317.17186, Culture=neutral, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_AD9348DC4493A66504DB02526E419114" + { + "Name" = "8:businesslogic.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:businesslogic.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_AEB6A1C9040B405D879808139EB0D378" + { + "SourcePath" = "8:..\\..\\..\\dep\\Imagery\\umbraco.ico" + "TargetName" = "8:umbraco.ico" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B914C40F58C09277BB8493610F624BA7" + { + "SourcePath" = "8:vslangproj80.olb" + "TargetName" = "8:vslangproj80.olb" + "Tag" = "8:" + "Folder" = "8:_73B0C616A8BB4F9C8EAA121307B00A0E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_BFDA41D2B373F97ADE98202496895FD8" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.ProjectAggregator, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_BFDA41D2B373F97ADE98202496895FD8" + { + "Name" = "8:Microsoft.VisualStudio.ProjectAggregator.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.ProjectAggregator.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_E67BBC8865F3231DBE18645E50209C79" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_E67BBC8865F3231DBE18645E50209C79" + { + "Name" = "8:EnvDTE.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:EnvDTE.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_EC3894ACAC9518C25134898C6B0C084B" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_EC3894ACAC9518C25134898C6B0C084B" + { + "Name" = "8:Microsoft.VisualStudio.Shell.Interop.9.0.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.9.0.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_F0A1398309CD846D7B9EF833FDA170D4" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:cms, Version=1.0.3317.32688, Culture=neutral, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_F0A1398309CD846D7B9EF833FDA170D4" + { + "Name" = "8:cms.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:cms.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_FBFD62A14CE6FCD6E76FF5CE8FFEE4AE" + { + "Name" = "8:Microsoft.VisualStudio.Shell.Interop.8.0.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.8.0.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + } + "FileType" + { + } + "Folder" + { + "{1525181F-901A-416C-8A58-119130FE478E}:_2052EE8191F54B088969D30273A196D9" + { + "Name" = "8:#1919" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:ProgramMenuFolder" + "Folders" + { + } + } + "{C7E34266-2C30-44B9-A9A3-4E394ABD6E18}:_73B0C616A8BB4F9C8EAA121307B00A0E" + { + "Name" = "8:#1927" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:GAC" + "Folders" + { + } + } + "{3C67513D-01DD-4637-8A68-80971EB9504F}:_9CEFC880051C415E8D84F1B285EB78FA" + { + "DefaultLocation" = "8:[ProgramFilesFolder][Manufacturer]\\[ProductName]" + "Name" = "8:#1925" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:TARGETDIR" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_FC771D075C8D495E998E793C808B4766" + { + "Name" = "8:#1916" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:DesktopFolder" + "Folders" + { + } + } + } + "LaunchCondition" + { + } + "Locator" + { + } + "MsiBootstrapper" + { + "LangId" = "3:1033" + "RequiresElevation" = "11:FALSE" + } + "Product" + { + "Name" = "8:Microsoft Visual Studio" + "ProductName" = "8:LINQ to Umbraco" + "ProductCode" = "8:{CB9A0CCF-BAB3-41F2-BEEF-CBBA78688CC9}" + "PackageCode" = "8:{3CAD9FDE-244D-4887-BFC4-3A38AFCBDED8}" + "UpgradeCode" = "8:{9333E29A-16A1-4E64-BA1C-841E709FF479}" + "RestartWWWService" = "11:FALSE" + "RemovePreviousVersions" = "11:FALSE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:FALSE" + "ProductVersion" = "8:0.0.1" + "Manufacturer" = "8:Umbraco" + "ARPHELPTELEPHONE" = "8:" + "ARPHELPLINK" = "8:http://umbraco.codeplex.com" + "Title" = "8:LINQ to Umbraco" + "Subject" = "8:" + "ARPCONTACT" = "8:Umbraco" + "Keywords" = "8:" + "ARPCOMMENTS" = "8:LINQ to Umbraco VS Plugin" + "ARPURLINFOABOUT" = "8:http://umbraco.org" + "ARPPRODUCTICON" = "8:_AEB6A1C9040B405D879808139EB0D378" + "ARPIconIndex" = "3:0" + "SearchPath" = "8:" + "UseSystemSearchPath" = "11:TRUE" + "TargetPlatform" = "3:0" + "PreBuildEvent" = "8:" + "PostBuildEvent" = "8:" + "RunPostBuildEvent" = "3:0" + } + "Registry" + { + "HKLM" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_6DCD2A80019F4D2D9AE0AE5F495A6C0C" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_C4DB2D81ADC8401A91A9C387E45FBC52" + { + "Name" = "8:Microsoft" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_16A8FDD7717E4BEF86E70F8614957C12" + { + "Name" = "8:.NETFramework" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_4E9DD339AD374936BC5D51BAEA46F7F8" + { + "Name" = "8:v4.0" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_4411497D8D0A4D96AED2464EC5AA882F" + { + "Name" = "8:AssemblyFoldersEx" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_6AE5BAFBC57544B5B985CC389A38CF74" + { + "Name" = "8:LINQtoUmbracoGenerator" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_F6530CAB2B544FE094B2F388A04CB065" + { + "Name" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:[TARGETDIR]" + } + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_55E2FA10871549D7951D3F0FD94865F2" + { + "Name" = "8:v3.5" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_9CC567803B0640278311B080195B7058" + { + "Name" = "8:AssemblyFoldersEx" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_7C0449C0145E4787ABD0617D227E56B9" + { + "Name" = "8:LINQtoUmbracoGenerator" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_0FC774523CF84E8C99436F29DC418133" + { + "Name" = "8:(Default)" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:2" + "Value" = "8:[TARGETDIR]" + } + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_A45494E9904849718D2A53C9FBE4C0B9" + { + "Name" = "8:VisualStudio" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_1222982D03B849989351846564B7D102" + { + "Name" = "8:9.0" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_2BFBF326494A4406904762D5E6D90C81" + { + "Name" = "8:Generators" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_3CB272C04F464CDE86AD0059ECA043F8" + { + "Name" = "8:{164B10B9-B200-11D0-8C61-00A0C91E29D5}" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_47113B8234AA42FD82ADE61FE9A0BDA8" + { + "Name" = "8:LINQtoUmbracoGenerator" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_2C3FDC3DD0B04281BBCAAA39F55C75B2" + { + "Name" = "8:GeneratesDesignTimeSource" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:3" + "Value" = "3:1" + } + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_AF104CE35E1C4377AA837573AD15E664" + { + "Name" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:VB LINQ to Umbraco Code Generator" + } + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_DC8494EE8B314FB9A6A7237865340B2C" + { + "Name" = "8:CLSID" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:{52B316AA-1997-4c81-9969-95404C09EEB4}" + } + } + } + } + "Values" + { + } + } + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_F08FDD1344684FFFA597AC41A50E20D7" + { + "Name" = "8:{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_939839EC2AEF45FFB0C73AF693CD8FEA" + { + "Name" = "8:LINQtoUmbracoGenerator" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_56017447FB084A97BCB380CE8D1AFD6F" + { + "Name" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:C# LINQ to Umbraco Code Generator" + } + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_A20B18D9F5A743B3A53AB7DEE84D8241" + { + "Name" = "8:CLSID" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:{52B316AA-1997-4c81-9969-95404C09EEB4}" + } + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_A46535DEB7B74040B1DB8D4746B99B3F" + { + "Name" = "8:GeneratesDesignTimeSource" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:3" + "Value" = "3:1" + } + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_CCC18AE33B484D4EA2FC9771DCA126F1" + { + "Name" = "8:10.0" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_6C6BD23CFA4C4873BD1F2AB322A9E2B8" + { + "Name" = "8:Generators" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_8CD6463DD52743ACBCE577562CD12F38" + { + "Name" = "8:{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_40A497F821FE4AECB8DD2B6AE7D3D17F" + { + "Name" = "8:LINQtoUmbracoGenerator" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_568E476991E54ADD882C95F2A1E17217" + { + "Name" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:C# LINQ to Umbraco Code Generator" + } + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_7C7885DC0A3B4B12B8572793170198CC" + { + "Name" = "8:GeneratesDesignTimeSource" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:3" + "Value" = "3:1" + } + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_9DA2C4C85E744EC08223EF56BEBB66C9" + { + "Name" = "8:CLSID" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:{52B316AA-1997-4c81-9969-95404C09EEB4}" + } + } + } + } + "Values" + { + } + } + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_DADC75A91B0A4DB19B62DD525978CAC5" + { + "Name" = "8:{164B10B9-B200-11D0-8C61-00A0C91E29D5}" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_8A2844B9F7E046B49CA3B5874DC61758" + { + "Name" = "8:LINQtoUmbracoGenerator" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_1AD0AC573DF448359D4927AB9BC330DD" + { + "Name" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:VB LINQ to Umbraco Code Generator" + } + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_E94CCEB18EB14E8BB5B09EE6F29E71A9" + { + "Name" = "8:CLSID" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:{52B316AA-1997-4c81-9969-95404C09EEB4}" + } + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_F19FDB317C274318B0CC4E78425E3FC8" + { + "Name" = "8:GeneratesDesignTimeSource" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:3" + "Value" = "3:1" + } + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCU" + { + "Keys" + { + } + } + "HKCR" + { + "Keys" + { + } + } + "HKU" + { + "Keys" + { + } + } + "HKPU" + { + "Keys" + { + } + } + } + "Sequences" + { + } + "Shortcut" + { + } + "UserInterface" + { + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_1B628D6B95D34589ACD6C20AEA00FDF1" + { + "Name" = "8:#1900" + "Sequence" = "3:1" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1F21BEC99A9648938695332D87AEA600" + { + "Sequence" = "3:320" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_7317CC181B254A0B96ED8E4CB00565AE" + { + "Sequence" = "3:210" + "DisplayName" = "8:License Agreement" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdLicenseDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "EulaText" + { + "Name" = "8:EulaText" + "DisplayName" = "8:#1008" + "Description" = "8:#1108" + "Type" = "3:6" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:0" + "UsePlugInResources" = "11:TRUE" + } + "Sunken" + { + "Name" = "8:Sunken" + "DisplayName" = "8:#1007" + "Description" = "8:#1107" + "Type" = "3:5" + "ContextData" = "8:4;True=4;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:4" + "DefaultValue" = "3:4" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_7DABC7EEFC164918AAF48DE3FE660CE3" + { + "Sequence" = "3:310" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "InstallAllUsersVisible" + { + "Name" = "8:InstallAllUsersVisible" + "DisplayName" = "8:#1059" + "Description" = "8:#1159" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_9277CD1C7BFF49FABA8F6605BA24D32C" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_33512CDDE856438390A31BE7A04388D2" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdBasicDialogs.wim" + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_38E55C707A2147A6B3A4CAA0E0140585" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdUserInterface.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_3A8B4B82014A414DACF26D176DB012C7" + { + "Name" = "8:#1901" + "Sequence" = "3:2" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_D238F2CE01B243D38C2788240466AB87" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_482F9F590E6F4A3F92776F874A338FA7" + { + "Name" = "8:#1902" + "Sequence" = "3:2" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_20C13BC47DF44DA4B468224F84C87604" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_50676D0814984405A46C2D4B224B7AD2" + { + "Name" = "8:#1900" + "Sequence" = "3:2" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_31B9C8D5274D4E249754477985EA44BA" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_A4F62A0FC6374584B05D992FBFE000D9" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_BFFD0FA47291402B9387BAAB5D4F2DA9" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_8E65F6A5BC084E63B55A3721513E49D6" + { + "Name" = "8:#1901" + "Sequence" = "3:1" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_0231BB90814540FF8F3D99232AD2FB5E" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_C5C9D6AD4FE54EE3A6D2777D042E401A" + { + "Name" = "8:#1902" + "Sequence" = "3:1" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_767C3EC3F9514911B77B74D015AAFBBE" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "UpdateText" + { + "Name" = "8:UpdateText" + "DisplayName" = "8:#1058" + "Description" = "8:#1158" + "Type" = "3:15" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1258" + "DefaultValue" = "8:#1258" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + } + "MergeModule" + { + } + "ProjectOutput" + { + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_6D30E9F6F22443EAB03C704C2A95705C" + { + "SourcePath" = "8:..\\Core\\obj\\Debug\\Umbraco.Linq.Core.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{31CAEC36-0C3D-4D69-B092-84866811EA07}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_A30C1F9054564E5692E22D1D82E217A9" + { + "SourcePath" = "8:..\\DTMetal.CodeBuilder\\obj\\Debug\\Umbraco.Linq.DTMetal.CodeBuilder.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_73B0C616A8BB4F9C8EAA121307B00A0E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{461089E7-008E-4737-BA17-E1FCD1CC3D0E}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_A8E59A7104A9450FBC9C4FFE80AE474C" + { + "SourcePath" = "8:" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:ContentFiles" + "OutputProjectGuid" = "8:{B151A571-D2F7-47DD-AFD6-C2C34ECA845B}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_B13BAC326D99486C99A5569F3BC4AC9C" + { + "SourcePath" = "8:..\\DTMetal.CodeBuilder\\obj\\Debug\\Umbraco.Linq.DTMetal.CodeBuilder.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{461089E7-008E-4737-BA17-E1FCD1CC3D0E}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_D04C94D3BAE248ADBB65968A9C8BAD7C" + { + "SourcePath" = "8:..\\DTMetal\\obj\\Debug\\DTMetal.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{11939510-3CFD-4781-9E00-22D23F418908}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_FCF81B3DB64748709DE0B4B360282466" + { + "SourcePath" = "8:" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9CEFC880051C415E8D84F1B285EB78FA" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:ContentFiles" + "OutputProjectGuid" = "8:{461089E7-008E-4737-BA17-E1FCD1CC3D0E}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal Installer/DTMetal Installer.vdproj.vspscc b/LinqToUmbraco/src/umbraco.Linq/DTMetal Installer/DTMetal Installer.vdproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal Installer/DTMetal Installer.vdproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj new file mode 100644 index 0000000000..7be8bfecb2 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj @@ -0,0 +1,93 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4872D945-97E8-4C30-8EDC-64E424645979} + Library + Properties + Umbraco.Linq.DTMetal.CodeBuilder.Installer + Umbraco.Linq.DTMetal.CodeBuilder.Installer + v3.5 + 512 + SAK + SAK + SAK + SAK + true + ..\Solution Items\umbraco-key.snk + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + + + + + + + Properties\SolutionInfo.cs + + + Component + + + Form + + + InstallerProgress.cs + + + + + + InstallerProgress.cs + + + + + + + + + Properties\umbraco-key.snk + + + + + {461089E7-008E-4737-BA17-E1FCD1CC3D0E} + DTMetal.CodeBuilder + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj.user b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj.user new file mode 100644 index 0000000000..5c2d6e6a78 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj.user @@ -0,0 +1,5 @@ + + + ShowAllFiles + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj.vspscc b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/DTMetal.CodeBuilder.Installer.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerHandler.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerHandler.cs new file mode 100644 index 0000000000..5deb41fb8c --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerHandler.cs @@ -0,0 +1,50 @@ +using System.ComponentModel; +using Microsoft.Win32; +using System.Windows.Forms; +using System.Globalization; + +namespace Umbraco.Linq.DTMetal.CodeBuilder.Installer +{ + [RunInstaller(true)] + public class InstallerHandler : System.Configuration.Install.Installer + { + public override void Install(System.Collections.IDictionary stateSaver) + { + base.Install(stateSaver); + + var vsPath = GetVsPath(); + var targetPath = Context.Parameters["TargetDir"]; + + if (vsPath != null && targetPath != null) + { + var progress = new InstallerProgress(InstallMode.Install, vsPath, targetPath); + MessageBoxOptions options = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ? MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading : 0; + if (progress.ShowDialog() != DialogResult.OK) + { + MessageBox.Show("VS 2008 Setup Failed", "LINQ to Umbraco Setup", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, options); + MessageBox.Show(progress.Error.ToString()); + } + } + } + + private static string GetVsPath() + { + RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0", false); + if (key != null) + return (string)key.GetValue("InstallDir"); + return null; + } + + public override void Uninstall(System.Collections.IDictionary savedState) + { + base.Uninstall(savedState); + + var vsPath = GetVsPath(); + if (vsPath != null) + { + var progress = new InstallerProgress(InstallMode.Uninstall, vsPath, null); + progress.ShowDialog(); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.Designer.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.Designer.cs new file mode 100644 index 0000000000..de7a076113 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.Designer.cs @@ -0,0 +1,84 @@ +namespace Umbraco.Linq.DTMetal.CodeBuilder.Installer +{ + partial class InstallerProgress + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallerProgress)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.installWorker = new System.ComponentModel.BackgroundWorker(); + this.SuspendLayout(); + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.Name = "label1"; + // + // label2 + // + resources.ApplyResources(this.label2, "label2"); + this.label2.Name = "label2"; + // + // progressBar1 + // + resources.ApplyResources(this.progressBar1, "progressBar1"); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + // + // installWorker + // + this.installWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.installWorker_DoWork); + this.installWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.installWorker_RunWorkerCompleted); + // + // InstallerProgress + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ControlBox = false; + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InstallerProgress"; + this.Load += new System.EventHandler(this.InstallerProgress_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ProgressBar progressBar1; + private System.ComponentModel.BackgroundWorker installWorker; + } +} \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.cs new file mode 100644 index 0000000000..d37126cacd --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.cs @@ -0,0 +1,287 @@ +using System; +using System.ComponentModel; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Diagnostics; +using System.Reflection; +using System.Globalization; +using Microsoft.Win32; +using System.Linq; + +namespace Umbraco.Linq.DTMetal.CodeBuilder.Installer +{ + public partial class InstallerProgress : Form + { + private const string generatorKey = "{52B316AA-1997-4c81-9969-95404C09EEB4}"; + private const string dtml = ".dtml"; + private const string clas = "LINQtoUmbraco.DTML.1.0"; + private const string desc = "LINQ to Umbraco Entity Mapping"; + + private InstallMode _mode; + private string _vsPath; + private string _targetPath; + + public InstallerProgress(InstallMode mode, string vsPath, string targetPath) + { + InitializeComponent(); + + _mode = mode; + _vsPath = vsPath; + _targetPath = targetPath; + } + + #region Events + private void installWorker_DoWork(object sender, DoWorkEventArgs e) + { + + switch (_mode) + { + case InstallMode.Install: + InstallVsTemplates(); + SetupRegistry(); + InstallDtmlXsd(); + ConfigVs(); + break; + case InstallMode.Uninstall: + UninstallVsTemplates(); + TearDownRegistry(); + UninstallDtmlXsd(); + ConfigVs(); + break; + default: + break; + } + } + + private void installWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + if (e.Error != null) + { + this.DialogResult = DialogResult.Cancel; + this.Error = e.Error; + } + else + { + this.DialogResult = DialogResult.OK; + } + } + public Exception Error { get; set; } + + private void InstallerProgress_Load(object sender, EventArgs e) + { + installWorker.RunWorkerAsync(); + } + #endregion + + #region Uninstall + private void UninstallDtmlXsd() + { + try + { + File.Delete(GetDtmlXsdPath()); + } + catch { } + } + + private void TearDownRegistry() + { + if(Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey) != null) + { + Registry.LocalMachine.DeleteSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey); + } + + if (Registry.ClassesRoot.OpenSubKey(dtml) != null) + { + Registry.ClassesRoot.DeleteSubKeyTree(dtml); + } + + if (Registry.ClassesRoot.OpenSubKey(clas) != null) + { + Registry.ClassesRoot.DeleteSubKeyTree(clas); + } + } + + private void UninstallVsTemplates() + { + string csTgt = Path.Combine(_vsPath, @"ItemTemplates\CSharp\1033\LINQtoUmbracoCS.zip"); + string vbTgt = Path.Combine(_vsPath, @"ItemTemplates\VisualBasic\1033\LINQtoUmbracoVB.zip"); + + try + { + File.Delete(csTgt); + File.Delete(vbTgt); + } + catch { } + } + #endregion + + #region Install + private void InstallDtmlXsd() + { + //string assemblyName = GetCodeBuilderAssemblyName(); + //Assembly assembly = Assembly.Load(assemblyName); + + //it seems that it runs this before the GAC is deployed, so the above code deosn't work + //I have to embed the XSD in this assembly instead + var assembly = Assembly.GetExecutingAssembly(); + + // Load the XSD for DocTypeML. + string xsd; + using (Stream s = ClassGenerator.GetXsd()) + { + using (StreamReader sr = new StreamReader(s)) + { + xsd = sr.ReadToEnd(); + } + } + + // Write the XSD to the Visual Studio folder with XML schemas. + using (StreamWriter sw = File.CreateText(GetDtmlXsdPath())) + { + sw.Write(xsd); + } + } + + private void SetupRegistry() + { + #region LINQtoUmbracoGenerator Key + RegistryKey genKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey); + genKey.SetValue("Assembly", GetCodeBuilderAssemblyName()); //full name of the assembly which the generator is in + genKey.SetValue("Class", "Umbraco.Linq.DTMetal.CodeBuilder.LINQtoUmbracoGenerator"); //generator class + genKey.SetValue("InprocServer32", Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), @"system32\mscoree.dll")); + genKey.SetValue("ThreadingModel", "Both"); + genKey.Close(); + #endregion + + #region HKEY_CLASSES_ROOT\.dtml + { + RegistryKey dtmlKey = Registry.ClassesRoot.CreateSubKey(dtml, RegistryKeyPermissionCheck.ReadWriteSubTree); + dtmlKey.SetValue(null, clas); + dtmlKey.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0 + { + RegistryKey kClas = Registry.ClassesRoot.CreateSubKey(clas, RegistryKeyPermissionCheck.ReadWriteSubTree); + kClas.SetValue(null, desc); + kClas.SetValue("AlwaysShowExt", "1"); + + #region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\DefaultIcon + { + RegistryKey kIcon = kClas.CreateSubKey("DefaultIcon"); + kIcon.SetValue(null, Path.Combine(_targetPath, @"DTMetal.exe") + ",0"); + kIcon.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell + { + RegistryKey kShel = kClas.CreateSubKey("shell"); + + #region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open + { + RegistryKey kOpen = kShel.CreateSubKey("Open"); + + #region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open\Command + { + RegistryKey kComm = kOpen.CreateSubKey("Command"); + kComm.SetValue(null, "\"" + Path.Combine(_vsPath, "devenv.exe") + "\" /dde \"%1\""); + kComm.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open\ddeexec + { + RegistryKey kDdex = kOpen.CreateSubKey("ddeexec"); + kDdex.SetValue(null, "Open(\"%1\")"); + + #region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open\ddeexec\Application + { + RegistryKey kAppn = kDdex.CreateSubKey("Application"); + kAppn.SetValue(null, "VisualStudio.9.0"); + kAppn.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open\ddeexec\Topic + { + RegistryKey kTopc = kDdex.CreateSubKey("Topic"); + kTopc.SetValue(null, "system"); + kTopc.Close(); + } + #endregion + + kDdex.Close(); + } + #endregion + + kOpen.Close(); + } + #endregion + + kShel.Close(); + } + #endregion + + kClas.Close(); + } + #endregion + } + + private void InstallVsTemplates() + { + string csSrc = Path.Combine(_targetPath, @"Item packages\LINQtoUmbracoCS.zip"); + string vbSrc = Path.Combine(_targetPath, @"Item packages\LINQtoUmbracoVB.zip"); + string csTgt = Path.Combine(_vsPath, @"ItemTemplates\CSharp\1033\LINQtoUmbracoCS.zip"); + string vbTgt = Path.Combine(_vsPath, @"ItemTemplates\VisualBasic\1033\LINQtoUmbracoVB.zip"); + + if (!File.Exists(csTgt)) + File.Copy(csSrc, csTgt); + if (!File.Exists(vbTgt)) + File.Copy(vbSrc, vbTgt); + } + #endregion + + private static string GetCodeBuilderAssemblyName() + { + //get the assembly version info + AssemblyName current = Assembly.GetExecutingAssembly().GetName(); + + StringBuilder sb = new StringBuilder(); + foreach (byte b in current.GetPublicKeyToken()) + sb.AppendFormat("{0:x2}", b); + + string publicKeyToken = sb.ToString(); + string version = current.Version.ToString(); + + return String.Format(CultureInfo.InvariantCulture, "Umbraco.Linq.DTMetal.CodeBuilder, Version={0}, Culture=neutral, PublicKeyToken={1}", version, publicKeyToken); + } + + private string GetDtmlXsdPath() + { + string path = _vsPath; //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ + path = path.TrimEnd('\\'); //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE + path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7 + path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 9.0 + path = Path.Combine(path, "Xml"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml + path = Path.Combine(path, "Schemas"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas + path = Path.Combine(path, "DocTypeML.xsd"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas\DocTypeML.xsd + return path; + } + + private void ConfigVs() + { + string devenv = Path.Combine(_vsPath, "devenv.exe"); + Process p = Process.Start(devenv, "/InstallVSTemplates"); + p.WaitForExit(); + } + } + + public enum InstallMode + { + Install, + Uninstall + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.resx b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.resx new file mode 100644 index 0000000000..35832e825c --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/InstallerProgress.resx @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + True + + + + 13, 13 + + + 246, 13 + + + 0 + + + LINQ to Umbraco is configuring Visual Studio 2008 + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + True + + + 25, 30 + + + 221, 13 + + + 1 + + + This may take a few minutes, please stand by + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 16, 61 + + + 243, 27 + + + 2 + + + progressBar1 + + + System.Windows.Forms.ProgressBar, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + 17, 17 + + + True + + + 6, 13 + + + 275, 100 + + + + CenterParent + + + LINQ to Umbraco Installer Progress + + + installWorker + + + System.ComponentModel.BackgroundWorker, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + InstallerProgress + + + System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS.zip b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS.zip new file mode 100644 index 0000000000..84638a138a Binary files /dev/null and b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS.zip differ diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/LINQtoUmbracoCS.vstemplate b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/LINQtoUmbracoCS.vstemplate new file mode 100644 index 0000000000..599aed3ec2 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/LINQtoUmbracoCS.vstemplate @@ -0,0 +1,31 @@ + + + LINQ to Umbraco File + An empty LINQ to Umbraco file + umbraco.ico + CSharp + 100 + DataClasses.dtml + 1 + Umbraco.Linq.Core.Designer + 3.5 + + + + + System + + + System.Core + + + Umbraco.Linq.Core + + + dtml.dtml + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/dtml.dtml b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/dtml.dtml new file mode 100644 index 0000000000..a75fd32030 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/dtml.dtml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/umbraco.ico b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/umbraco.ico new file mode 100644 index 0000000000..402cf9594e Binary files /dev/null and b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoCS/umbraco.ico differ diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB.zip b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB.zip new file mode 100644 index 0000000000..d3d60ca34d Binary files /dev/null and b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB.zip differ diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/LINQtoUmbracoVB.vstemplate b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/LINQtoUmbracoVB.vstemplate new file mode 100644 index 0000000000..60845a7256 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/LINQtoUmbracoVB.vstemplate @@ -0,0 +1,31 @@ + + + LINQ to Umbraco File + An empty LINQ to Umbraco file + umbraco.ico + VisualBasic + 100 + DataClasses.dtml + 1 + Umbraco.Linq.Core.Designer + 3.5 + + + + + System + + + System.Core + + + Umbraco.Linq.Core + + + dtml.dtml + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/dtml.dtml b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/dtml.dtml new file mode 100644 index 0000000000..a75fd32030 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/dtml.dtml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/umbraco.ico b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/umbraco.ico new file mode 100644 index 0000000000..402cf9594e Binary files /dev/null and b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Item packages/LINQtoUmbracoVB/umbraco.ico differ diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Properties/AssemblyInfo.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..05dd8b56f1 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder.Installer/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +using System.Reflection; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DTMetal.CodeBuilder.Installer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("DTMetal.CodeBuilder.Installer")] \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/BaseCodeGenerator.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/BaseCodeGenerator.cs new file mode 100644 index 0000000000..6cd5b4f793 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/BaseCodeGenerator.cs @@ -0,0 +1,185 @@ + +/*************************************************************************** + +Copyright (c) Microsoft Corporation. All rights reserved. +This code is licensed under the Visual Studio SDK license terms. +THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. + +***************************************************************************/ + +using System; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + /// + /// A managed wrapper for VS's concept of an IVsSingleFileGenerator which is + /// a custom tool invoked at design time which can take any file as an input + /// and provide any file as output. + /// + public abstract class BaseCodeGenerator : IVsSingleFileGenerator + { + private IVsGeneratorProgress codeGeneratorProgress; + private string codeFileNameSpace = String.Empty; + private string codeFilePath = String.Empty; + + #region IVsSingleFileGenerator Members + + /// + /// Implements the IVsSingleFileGenerator.DefaultExtension method. + /// Returns the extension of the generated file + /// + /// Out parameter, will hold the extension that is to be given to the output file name. The returned extension must include a leading period + /// S_OK if successful, E_FAIL if not + int IVsSingleFileGenerator.DefaultExtension(out string pbstrDefaultExtension) + { + try + { + pbstrDefaultExtension = GetDefaultExtension(); + return VSConstants.S_OK; + } + catch (Exception e) + { + Trace.WriteLine(Strings.GetDefaultExtensionFailed); + Trace.WriteLine(e.ToString()); + pbstrDefaultExtension = string.Empty; + return VSConstants.E_FAIL; + } + } + + /// + /// Implements the IVsSingleFileGenerator.Generate method. + /// Executes the transformation and returns the newly generated output file, whenever a custom tool is loaded, or the input file is saved + /// + /// The full path of the input file. May be a null reference (Nothing in Visual Basic) in future releases of Visual Studio, so generators should not rely on this value + /// The contents of the input file. This is either a UNICODE BSTR (if the input file is text) or a binary BSTR (if the input file is binary). If the input file is a text file, the project system automatically converts the BSTR to UNICODE + /// This parameter is meaningful only for custom tools that generate code. It represents the namespace into which the generated code will be placed. If the parameter is not a null reference (Nothing in Visual Basic) and not empty, the custom tool can use the following syntax to enclose the generated code + /// [out] Returns an array of bytes to be written to the generated file. You must include UNICODE or UTF-8 signature bytes in the returned byte array, as this is a raw stream. The memory for rgbOutputFileContents must be allocated using the .NET Framework call, System.Runtime.InteropServices.AllocCoTaskMem, or the equivalent Win32 system call, CoTaskMemAlloc. The project system is responsible for freeing this memory + /// [out] Returns the count of bytes in the rgbOutputFileContent array + /// A reference to the IVsGeneratorProgress interface through which the generator can report its progress to the project system + /// If the method succeeds, it returns S_OK. If it fails, it returns E_FAIL + int IVsSingleFileGenerator.Generate(string wszInputFilePath, string bstrInputFileContents, string wszDefaultNamespace, IntPtr[] rgbOutputFileContents, out uint pcbOutput, IVsGeneratorProgress pGenerateProgress) + { + if (bstrInputFileContents == null) + { + throw new ArgumentNullException(bstrInputFileContents); + } + + codeFilePath = wszInputFilePath; + codeFileNameSpace = wszDefaultNamespace; + codeGeneratorProgress = pGenerateProgress; + + byte[] bytes = GenerateCode(bstrInputFileContents); + + if (bytes == null) + { + // This signals that GenerateCode() has failed. Tasklist items have been put up in GenerateCode() + rgbOutputFileContents = null; + pcbOutput = 0; + + // Return E_FAIL to inform Visual Studio that the generator has failed (so that no file gets generated) + return VSConstants.E_FAIL; + } + else + { + // The contract between IVsSingleFileGenerator implementors and consumers is that + // any output returned from IVsSingleFileGenerator.Generate() is returned through + // memory allocated via CoTaskMemAlloc(). Therefore, we have to convert the + // byte[] array returned from GenerateCode() into an unmanaged blob. + + int outputLength = bytes.Length; + rgbOutputFileContents[0] = Marshal.AllocCoTaskMem(outputLength); + Marshal.Copy(bytes, 0, rgbOutputFileContents[0], outputLength); + pcbOutput = (uint)outputLength; + return VSConstants.S_OK; + } + } + + #endregion + + /// + /// Namespace for the file + /// + protected string FileNameSpace + { + get + { + return codeFileNameSpace; + } + } + + /// + /// File-path for the input file + /// + protected string InputFilePath + { + get + { + return codeFilePath; + } + } + + /// + /// Interface to the VS shell object we use to tell our progress while we are generating + /// + internal IVsGeneratorProgress CodeGeneratorProgress + { + get + { + return codeGeneratorProgress; + } + } + + /// + /// Gets the default extension for this generator + /// + /// String with the default extension for this generator + protected abstract string GetDefaultExtension(); + + /// + /// The method that does the actual work of generating code given the input file + /// + /// File contents as a string + /// The generated code file as a byte-array + protected abstract byte[] GenerateCode(string inputFileContent); + + /// + /// Method that will communicate an error via the shell callback mechanism + /// + /// Level or severity + /// Text displayed to the user + /// Line number of error + /// Column number of error + protected virtual void GeneratorError(uint level, string message, uint line, uint column) + { + IVsGeneratorProgress progress = CodeGeneratorProgress; + if (progress != null) + { + progress.GeneratorError(0, level, message, line, column); + } + } + + /// + /// Method that will communicate a warning via the shell callback mechanism + /// + /// Level or severity + /// Text displayed to the user + /// Line number of warning + /// Column number of warning + protected virtual void GeneratorWarning(uint level, string message, uint line, uint column) + { + IVsGeneratorProgress progress = CodeGeneratorProgress; + if (progress != null) + { + progress.GeneratorError(1, level, message, line, column); + } + } + } +} \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/BaseCodeGeneratorWithSite.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/BaseCodeGeneratorWithSite.cs new file mode 100644 index 0000000000..ad6dc43e17 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/BaseCodeGeneratorWithSite.cs @@ -0,0 +1,199 @@ + +/*************************************************************************** + +Copyright (c) Microsoft Corporation. All rights reserved. +This code is licensed under the Visual Studio SDK license terms. +THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. + +***************************************************************************/ + +using System; +using System.CodeDom.Compiler; +using System.Diagnostics; +using System.Runtime.InteropServices; +using EnvDTE; +using EnvDTE80; +using VSLangProj; +using VSOLE = Microsoft.VisualStudio.OLE.Interop; +using Microsoft.VisualStudio; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.Designer.Interfaces; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + /// + /// Base code generator with site implementation + /// + public abstract class BaseCodeGeneratorWithSite : BaseCodeGenerator, VSOLE.IObjectWithSite + { + private object site = null; + private CodeDomProvider codeDomProvider = null; + private ServiceProvider serviceProvider = null; + + #region IObjectWithSite Members + + /// + /// GetSite method of IOleObjectWithSite + /// + /// interface to get + /// IntPtr in which to stuff return value + void VSOLE.IObjectWithSite.GetSite(ref Guid riid, out IntPtr ppvSite) + { + if (site == null) + { + throw new COMException("object is not sited", VSConstants.E_FAIL); + } + + IntPtr pUnknownPointer = Marshal.GetIUnknownForObject(site); + IntPtr intPointer = IntPtr.Zero; + Marshal.QueryInterface(pUnknownPointer, ref riid, out intPointer); + + if (intPointer == IntPtr.Zero) + { + throw new COMException("site does not support requested interface", VSConstants.E_NOINTERFACE); + } + + ppvSite = intPointer; + } + + /// + /// SetSite method of IOleObjectWithSite + /// + /// site for this object to use + void VSOLE.IObjectWithSite.SetSite(object pUnkSite) + { + site = pUnkSite; + codeDomProvider = null; + serviceProvider = null; + } + + #endregion + + /// + /// Demand-creates a ServiceProvider + /// + private ServiceProvider SiteServiceProvider + { + get + { + if (serviceProvider == null) + { + serviceProvider = new ServiceProvider(site as VSOLE.IServiceProvider); + Debug.Assert(serviceProvider != null, "Unable to get ServiceProvider from site object."); + } + return serviceProvider; + } + } + + /// + /// Method to get a service by its GUID + /// + /// GUID of service to retrieve + /// An object that implements the requested service + protected object GetService(Guid serviceGuid) + { + return SiteServiceProvider.GetService(serviceGuid); + } + + /// + /// Method to get a service by its Type + /// + /// Type of service to retrieve + /// An object that implements the requested service + protected object GetService(Type serviceType) + { + return SiteServiceProvider.GetService(serviceType); + } + + /// + /// Returns a CodeDomProvider object for the language of the project containing + /// the project item the generator was called on + /// + /// A CodeDomProvider object + protected virtual CodeDomProvider GetCodeProvider() + { + if (codeDomProvider == null) + { + //Query for IVSMDCodeDomProvider/SVSMDCodeDomProvider for this project type + IVSMDCodeDomProvider provider = GetService(typeof(SVSMDCodeDomProvider)) as IVSMDCodeDomProvider; + if (provider != null) + { + codeDomProvider = provider.CodeDomProvider as CodeDomProvider; + } + else + { + //In the case where no language specific CodeDom is available, fall back to C# + codeDomProvider = CodeDomProvider.CreateProvider("C#"); + } + } + return codeDomProvider; + } + + /// + /// Gets the default extension of the output file from the CodeDomProvider + /// + /// + protected override string GetDefaultExtension() + { + CodeDomProvider codeDom = GetCodeProvider(); + Debug.Assert(codeDom != null, "CodeDomProvider is NULL."); + string extension = codeDom.FileExtension; + if (extension != null && extension.Length > 0) + { + extension = "." + extension.TrimStart(".".ToCharArray()); + } + return extension; + } + + /// + /// Returns the EnvDTE.ProjectItem object that corresponds to the project item the code + /// generator was called on + /// + /// The EnvDTE.ProjectItem of the project item the code generator was called on + protected ProjectItem GetProjectItem() + { + object p = GetService(typeof(ProjectItem)); + Debug.Assert(p != null, "Unable to get Project Item."); + return (ProjectItem)p; + } + + /// + /// Returns the EnvDTE.Project object of the project containing the project item the code + /// generator was called on + /// + /// + /// The EnvDTE.Project object of the project containing the project item the code generator was called on + /// + protected Project GetProject() + { + return GetProjectItem().ContainingProject; + } + + /// + /// Returns the VSLangProj.VSProjectItem object that corresponds to the project item the code + /// generator was called on + /// + /// The VSLangProj.VSProjectItem of the project item the code generator was called on + protected VSProjectItem GetVSProjectItem() + { + return (VSProjectItem)GetProjectItem().Object; + } + + /// + /// Returns the VSLangProj.VSProject object of the project containing the project item the code + /// generator was called on + /// + /// + /// The VSLangProj.VSProject object of the project containing the project item + /// the code generator was called on + /// + protected VSProject GetVSProject() + { + return (VSProject)GetProject().Object; + } + } +} \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/ClassDiagram.cd b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/ClassDiagram.cd new file mode 100644 index 0000000000..ebf6d5a831 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/ClassDiagram.cd @@ -0,0 +1,27 @@ + + + + + + AAAAAAAAAAAAAAAIAAAAAAAgAAAEAAAAAAAAAAACAAA= + DtmlCodeGenerator.cs + + + + + + AAAAABAAAAAAAAAIAAQAIAAEAAAAMABAABAAABACAIA= + BaseCodeGenerator.cs + + + + + + + AAAAAABAAAAAQQAAAIAAAAAAQAAFACAABgAAAEACAEA= + BaseCodeGeneratorWithSite.cs + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/ClassGenerator.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/ClassGenerator.cs new file mode 100644 index 0000000000..36bb1d0047 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/ClassGenerator.cs @@ -0,0 +1,724 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.CodeDom.Compiler; +using System.CodeDom; +using System.Runtime.Serialization; +using System.IO; +using System.Xml.Linq; +using System.Xml.Schema; +using Microsoft.VisualBasic; +using Microsoft.CSharp; +using System.Globalization; +using System.Reflection; +using umbraco.Linq.DTMetal.CodeBuilder.DataType; +using VB = Microsoft.VisualBasic; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + public enum GenerationLanguage + { + CSharp, + VB + } + + internal enum SerializationMode + { + None, Unidirectional + } + + internal sealed class ClassGeneratorArgs + { + public string Namespace { get; set; } + public CodeDomProvider Provider { get; set; } + public string DtmlPath { get; set; } + public XDocument Dtml { get; set; } + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] + public sealed class ClassGenerator + { + internal ClassGeneratorArgs Args { get; set; } + internal bool PluralizeCollections { get; set; } + internal SerializationMode SerializationMode { get; set; } + private CodeCompileUnit Code { get; set; } + + internal bool IsCSharpCodeProvider() + { + return (string.Compare(this.Args.Provider.FileExtension, "CS", StringComparison.OrdinalIgnoreCase) == 0); + } + + /// + /// Creates a new CodeBuilder. + /// + /// The path to the DTML file + /// The language to generate with. + /// + public static ClassGenerator CreateBuilder(string xmlPath, string ns, GenerationLanguage lang) + { + var args = new ClassGeneratorArgs() + { + DtmlPath = xmlPath, + Namespace = ns + }; + switch (lang) + { + case GenerationLanguage.VB: + args.Provider = new VBCodeProvider(); + break; + + case GenerationLanguage.CSharp: + default: + args.Provider = new CSharpCodeProvider(); + break; + } + + return new ClassGenerator(args); + } + + internal ClassGenerator(ClassGeneratorArgs args) + { + this.Args = args; + } + + public void Save() + { + if (this.Code == null) + { + this.GenerateCode(); + } + + var dtml = new FileInfo(this.Args.DtmlPath); + + CodeGeneratorOptions options = new CodeGeneratorOptions(); + options.BracingStyle = "C"; + using (StreamWriter sourceWriter = new StreamWriter(dtml.FullName.Replace("dtml", "designer." + this.Args.Provider.FileExtension))) + { + this.Args.Provider.GenerateCodeFromCompileUnit(this.Code, sourceWriter, options); + } + } + + internal byte[] SaveForVs() + { + if (this.Code == null) + { + this.GenerateCode(); + } + + CodeGeneratorOptions options = new CodeGeneratorOptions(); + options.BracingStyle = "C"; + + StringBuilder code = new StringBuilder(); + TextWriter tw = new StringWriter(code, CultureInfo.InvariantCulture); + this.Args.Provider.GenerateCodeFromCompileUnit(this.Code, tw, null); + tw.Flush(); + + Encoding enc = Encoding.GetEncoding(tw.Encoding.WindowsCodePage); + byte[] preamble = enc.GetPreamble(); + int preambleLength = preamble.Length; + byte[] body = enc.GetBytes(code.ToString()); + Array.Resize(ref preamble, preambleLength + body.Length); + Array.Copy(body, 0, preamble, preambleLength, body.Length); + + // Return generated code. + return preamble; + } + + public void GenerateCode() + { + if (Args == null) + { + throw new ArgumentNullException("Args"); + } + + if (!string.IsNullOrEmpty(this.Args.DtmlPath)) + { + var dtml = new FileInfo(this.Args.DtmlPath); + if (!dtml.Exists) + { + throw new FileNotFoundException(String.Format(Strings.DtmlNotFound, this.Args.DtmlPath)); + } + else + { + this.Args.Dtml = XDocument.Load(this.Args.DtmlPath); + } + } + + ValidateSchema(); + + this.PluralizeCollections = (bool)this.Args.Dtml.Root.Attribute("PluralizeCollections"); + this.SerializationMode = (SerializationMode)Enum.Parse(typeof(SerializationMode), (string)this.Args.Dtml.Root.Attribute("Serialization")); + + IEnumerable docTypes = XmlToClasses(this.Args.Dtml); + + this.Code = new CodeCompileUnit(); + CodeNamespace ns = GenerateNamespace(this.Args.Namespace); + + CodeTypeDeclaration dataContext = CreateDataContext(this.Args.Dtml, docTypes); + + ns.Types.Add(dataContext); + + CreateDocTypes(docTypes, ns); + + this.Code.Namespaces.Add(ns); + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] + private CodeTypeDeclaration CreateDataContext(XDocument dtmlXml, IEnumerable docTypes) + { + string methodName = "OnCreated"; + CodeExpressionStatement statement = new CodeExpressionStatement(new CodeMethodInvokeExpression(null, methodName, new CodeExpression[0])); + + string dataContextName = dtmlXml.Root.Attribute("DataContextName").Value; + //ensure the naming is standard + if (!dataContextName.ToUpper().Contains("DATACONTEXT")) + { + dataContextName += "DataContext"; + } + CodeTypeDeclaration dataContext = new CodeTypeDeclaration(dataContextName); + dataContext.BaseTypes.Add("umbracoDataContext"); + dataContext.IsClass = true; + dataContext.IsPartial = true; + + string partialOnCreated = string.Empty; + if (IsCSharpCodeProvider()) + { + partialOnCreated = " partial void " + methodName + "();\r\n"; + } + else + { + partialOnCreated = " Partial Private Void " + methodName + "()\r\nEnd Sub\r\n"; + } + CodeSnippetTypeMember onCreated = new CodeSnippetTypeMember(partialOnCreated); + CodeRegionDirective region = new CodeRegionDirective(CodeRegionMode.Start, "Partials"); + onCreated.StartDirectives.Add(region); + onCreated.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, "Partials")); + dataContext.Members.Add(onCreated); + + //constructor with no arguments + CodeConstructor ctor = new CodeConstructor(); + ctor.Attributes = MemberAttributes.Public; + ctor.BaseConstructorArgs.Add(new CodePropertyReferenceExpression()); + ctor.Statements.Add(statement); + dataContext.Members.Add(ctor); + + //constructor that takes an umbracoDataProvider + ctor = new CodeConstructor(); + ctor.Attributes = MemberAttributes.Public; + ctor.Parameters.Add(new CodeParameterDeclarationExpression("umbracoDataProvider", "provider")); + ctor.BaseConstructorArgs.Add(new CodePropertyReferenceExpression(null, "provider")); + ctor.Statements.Add(statement); + dataContext.Members.Add(ctor); + + //Generate the Tree for each docType + foreach (var dt in docTypes) + { + string name = dt.TypeName; + if (this.PluralizeCollections) + { + name = PluraliseName(dt.TypeName); + } + var t = new CodeTypeReference("Tree"); + t.TypeArguments.Add(dt.TypeName); + + CodeMemberProperty p = new CodeMemberProperty(); + p.Name = name; + p.Type = t; + p.Attributes = MemberAttributes.Public | MemberAttributes.Final; + p.HasGet = true; + p.HasSet = false; + + p.GetStatements.Add( + new CodeMethodReturnStatement( + new CodeMethodInvokeExpression( + new CodeMethodReferenceExpression( + new CodeThisReferenceExpression(), + "LoadTree", + new CodeTypeReference[] { + new CodeTypeReference(dt.TypeName) + }), + new CodeExpression[0]) + ) + ); + + dataContext.Members.Add(p); + } + return dataContext; + } + + internal IEnumerable XmlToClasses(XDocument dtmlXml) + { + return dtmlXml.Descendants("DocumentType").Select(x => new DocType + { + Alias = (string)x.Element("Alias"), + Description = (string)x.Element("Description"), + Id = (int)x.Element("Id"), + Name = (string)x.Element("Name"), + ParentId = (int)x.Attribute("ParentId"), + TypeName = Normalise((string)x.Element("Alias")), + Properties = x.Descendants("Property").Select(p => new DocTypeProperty + { + Alias = (string)p.Element("Alias"), + ControlId = new Guid((string)p.Element("ControlId")), + DatabaseType = Type.GetType((string)p.Element("Type")), + Description = (string)p.Element("Description"), + Id = (int)p.Element("Id"), + Name = (string)p.Element("Name"), + Mandatory = (bool)p.Element("Mandatory"), + RegularExpression = (string)p.Element("RegularExpression"), + TypeName = Normalise((string)p.Element("Alias")) + }).ToList(), + Associations = x.Descendants("Association").Select(a => new DocTypeAssociation + { + AllowedId = (int)a + }).ToList() + }); + } + + private void ValidateSchema() + { + XmlSchemaSet schemas = new XmlSchemaSet(); + //read the resorce for the XSD to validate against + Assembly assembly = Assembly.GetExecutingAssembly(); + schemas.Add("", System.Xml.XmlReader.Create(assembly.GetManifestResourceStream(assembly.GetName().Name + ".DocTypeML.xsd"))); + + //we'll have a list of all validation exceptions to put them to the screen + List exList = new List(); + + //some funky in-line event handler. Lambda loving goodness ;) + this.Args.Dtml.Validate(schemas, (o, e) => { exList.Add(e.Exception); }); + + if (exList.Count > 0) + { + //dump out the exception list + StringBuilder sb = new StringBuilder(); + sb.AppendLine(umbraco.Linq.DTMetal.CodeBuilder.Strings.XsdValidationFailureHeading); + foreach (var item in exList) + { + sb.AppendLine(" * " + item.Message + " - " + item.StackTrace); + } + throw new XmlSchemaException(sb.ToString()); + } + } + + private void CreateDocTypes(IEnumerable docTypes, CodeNamespace ns) + { + foreach (var docType in docTypes) + { + string genName = docType.TypeName; + + CodeCompileUnit currUnit = new CodeCompileUnit(); + + currUnit.Namespaces.Add(ns); + + //create class + CodeTypeDeclaration currClass = new CodeTypeDeclaration(genName); + //create the custom attribute + CodeAttributeDeclarationCollection classAttributes = new CodeAttributeDeclarationCollection( + new CodeAttributeDeclaration[] { + new CodeAttributeDeclaration("umbracoInfo", + new CodeAttributeArgument(new CodePrimitiveExpression(docType.Alias)), + new CodeAttributeArgument("Id", new CodePrimitiveExpression(docType.Id))), + new CodeAttributeDeclaration(new CodeTypeReference(typeof(DataContractAttribute))), + new CodeAttributeDeclaration("DocType") + }); + //add the address to the class + currClass.CustomAttributes.AddRange(classAttributes); + + currClass.IsClass = true; + //add the summary decoration + currClass.Comments.AddRange(GenerateSummary(docType.Description)); + //set up the type + currClass.TypeAttributes = TypeAttributes.Public; + if (docType.ParentId > 0) + { + currClass.BaseTypes.Add(new CodeTypeReference(docTypes.Single(d => d.Id == docType.ParentId).TypeName)); //docType inheritance + } + else + { + currClass.BaseTypes.Add(new CodeTypeReference("DocTypeBase")); //base class + } + currClass.IsPartial = true; + + currClass.Members.AddRange(GenerateConstructors()); + + #region Doc Type Properties + foreach (var docTypeProperty in docType.Properties) + { + CodeMemberField valueField = new CodeMemberField(); + valueField.Attributes = MemberAttributes.Private; + valueField.Name = "_" + docTypeProperty.TypeName; + valueField.Type = new CodeTypeReference(docTypeProperty.DatabaseType); + currClass.Members.Add(valueField); + + //store the umbraco data in an attribute. + CodeMemberProperty p = new CodeMemberProperty(); + p.CustomAttributes.AddRange(GenerateDocTypePropertyAttributes(docTypeProperty)); + + p.Name = docTypeProperty.TypeName; + p.Type = new CodeTypeReference(docTypeProperty.DatabaseType); + p.Attributes = MemberAttributes.Public; + p.HasGet = true; + p.HasSet = false; + p.GetStatements.Add(new CodeMethodReturnStatement( + new CodeFieldReferenceExpression( + new CodeThisReferenceExpression(), valueField.Name)) + ); + + #region Set statement + //have a conditional statment so we can use the INotifyChanging and INotifyChanged events + CodeExpression left = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), valueField.Name); + CodeExpression right = new CodePropertySetValueReferenceExpression(); + + CodeExpression cond = GenerateInequalityConditionalStatement(left, right); + + //Build the statements to execute when we are changing the property value + //The order is: + // - RaisePropertyChanging event + // - Assign the property + // - RaisePropertyChanged event + var trues = new CodeStatement[] { + new CodeExpressionStatement(new CodeMethodInvokeExpression( + new CodeThisReferenceExpression(), + "RaisePropertyChanging" + ) + ), + new CodeAssignStatement( + new CodeFieldReferenceExpression( + new CodeThisReferenceExpression(), valueField.Name), + new CodePropertySetValueReferenceExpression() + ), + new CodeExpressionStatement( + new CodeMethodInvokeExpression( + new CodeThisReferenceExpression(), + "RaisePropertyChanged", + new CodePrimitiveExpression(docTypeProperty.TypeName) + ) + ) + }; + + CodeConditionStatement condition = new CodeConditionStatement(cond, trues); + //enforce the validation from umbraco. It's there for a reason ;) + if (!string.IsNullOrEmpty(docTypeProperty.RegularExpression)) + { + p.SetStatements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression( + null, + "ValidateProperty", + new CodePrimitiveExpression(docTypeProperty.RegularExpression), + new CodePropertySetValueReferenceExpression()) + ) + ); + } + p.SetStatements.Add(condition); + #endregion + + //comment the property with the description from umbraco + p.Comments.AddRange(GenerateSummary(docTypeProperty.Description)); + currClass.Members.Add(p); + + CodeMemberProperty retypedProperty = CreateCustomProperty(docTypeProperty, valueField.Name); + if (retypedProperty != null) + { + currClass.Members.Add(retypedProperty); + } + } + #endregion + + #region Child Associations + foreach (var child in docType.Associations) + { + var realDocType = docTypes.SingleOrDefault(dt => dt.Id == child.AllowedId); + + //put a check that a docType is actually returned + //This will cater for the bug of when you don't select to generate a + //docType but it is a child of the current + if (realDocType != null) + { + CodeMemberField childMember = new CodeMemberField(); + string name = realDocType.TypeName; + if (this.PluralizeCollections) + { + name = PluraliseName(realDocType.TypeName); + } + childMember.Attributes = MemberAttributes.Private; + childMember.Name = "_" + name; + var t = new CodeTypeReference("AssociationTree"); + t.TypeArguments.Add(realDocType.TypeName); + childMember.Type = t; + currClass.Members.Add(childMember); + + CodeMemberProperty p = new CodeMemberProperty(); + p.Name = name; + p.Type = t; + p.Attributes = MemberAttributes.Public | MemberAttributes.Final; + p.HasGet = true; + p.HasSet = true; + + CodeExpression left = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), childMember.Name); + CodeExpression right = new CodePrimitiveExpression(null); + + CodeExpression cond = GenerateEqualityConditionalStatement(left, right); + + var trues = new CodeConditionStatement(cond, new CodeAssignStatement( + new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), childMember.Name), + new CodeMethodInvokeExpression( + new CodeMethodReferenceExpression( + new CodeThisReferenceExpression(), + "ChildrenOfType", + new CodeTypeReference[] { + new CodeTypeReference(realDocType.TypeName) + }) + ) + ) + ); + + p.GetStatements.Add(trues); + p.GetStatements.Add(new CodeMethodReturnStatement( + new CodeFieldReferenceExpression( + new CodeThisReferenceExpression(), childMember.Name)) + ); + + p.SetStatements.Add( + new CodeAssignStatement( + new CodeFieldReferenceExpression( + new CodeThisReferenceExpression(), childMember.Name), + new CodePropertySetValueReferenceExpression() + ) + ); + + currClass.Members.Add(p); + } + } + #endregion + + ns.Types.Add(currClass); + } + } + + private CodeMemberProperty CreateCustomProperty(DocTypeProperty docTypeProperty, string privateVariableName) + { + var internalTypes = Assembly.GetExecutingAssembly().GetTypes().Where(t => typeof(DataTypeRetyper).IsAssignableFrom(t) && t.GetCustomAttributes(typeof(DataTypeAttribute), true).Length == 1); + + var currType = internalTypes.SingleOrDefault(t => t.GetCustomAttributes(typeof(DataTypeAttribute), true).Cast().First().ControlId == docTypeProperty.ControlId); + if (currType != null) + { + var retyper = (DataTypeRetyper)Activator.CreateInstance(currType); + + CodeMemberProperty p = new CodeMemberProperty(); + p.Type = new CodeTypeReference(retyper.MemberType); + p.Name = retyper.MemberName(docTypeProperty.TypeName); + p.HasGet = true; + p.HasSet = false; + + new Switch(retyper) + .Case(b => { + p.GetStatements.Add(new CodeMethodReturnStatement( + GenerateEqualityConditionalStatement( + new CodeFieldReferenceExpression( + new CodeThisReferenceExpression(), privateVariableName) + , new CodePrimitiveExpression(0) + ) + ) + ); + }, true) + ; + + return p; + } + + return null; + } + + private CodeExpression GenerateInequalityConditionalStatement(CodeExpression left, CodeExpression right) + { + //Build a binary conditional operation (an IF) + CodeExpression cond; + //if (GenerationLanaguage == Language.CSharp) + //{ + cond = new CodeBinaryOperatorExpression( + left, + CodeBinaryOperatorType.IdentityInequality, + right + ); + //} + //else + //{ + // cond = new CodeBinaryOperatorExpression( + // new CodeBinaryOperatorExpression( + // left, + // CodeBinaryOperatorType.IdentityEquality, + // right + // ), + // CodeBinaryOperatorType.ValueEquality, + // new CodePrimitiveExpression(false) + // ); + //} + return cond; + } + + private CodeExpression GenerateEqualityConditionalStatement(CodeExpression left, CodeExpression right) + { + //Build a binary conditional operation (an IF) + CodeExpression cond; + //if (GenerationLanaguage == Language.CSharp) + //{ + cond = new CodeBinaryOperatorExpression( + left, + CodeBinaryOperatorType.IdentityEquality, + right + ); + //} + //else + //{ + // cond = new CodeBinaryOperatorExpression( + // new CodeBinaryOperatorExpression( + // left, + // CodeBinaryOperatorType.IdentityInequality, + // right + // ), + // CodeBinaryOperatorType.ValueEquality, + // new CodePrimitiveExpression(false) + // ); + //} + return cond; + } + + private CodeAttributeDeclaration[] GenerateDocTypePropertyAttributes(DocTypeProperty docTypeProperty) + { + List attrs = new List(); + + CodeAttributeDeclaration umbInfoAtt = new CodeAttributeDeclaration("umbracoInfo", + new CodeAttributeArgument(new CodePrimitiveExpression(docTypeProperty.Alias)), + new CodeAttributeArgument("DisplayName", new CodePrimitiveExpression(docTypeProperty.Name)), + new CodeAttributeArgument("Mandatory", new CodePrimitiveExpression(docTypeProperty.Mandatory)) + ); + + attrs.Add(umbInfoAtt); + attrs.Add(new CodeAttributeDeclaration("Property")); + if (this.SerializationMode == SerializationMode.Unidirectional) + { + CodeAttributeDeclaration dataMemberAtt = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DataMemberAttribute)), + new CodeAttributeArgument("Name", new CodePrimitiveExpression(docTypeProperty.TypeName)) + ); + } + + return attrs.ToArray(); + } + + private static CodeTypeMember[] GenerateConstructors() + { + CodeConstructor defaultConstructor = new CodeConstructor(); + defaultConstructor.Attributes = MemberAttributes.Public; + + return new CodeTypeMember[] { defaultConstructor }; + } + + private static CodeNamespace GenerateNamespace(string name) + { + CodeNamespace ns = new CodeNamespace(name); + //ns.Imports.Add(new CodeNamespaceImport("System")); + ns.Imports.Add(new CodeNamespaceImport("umbraco.Linq.Core")); + ns.Imports.Add(new CodeNamespaceImport("umbraco.Linq.Core.Node")); + ns.Imports.Add(new CodeNamespaceImport("System.Linq")); + return ns; + } + + private static CodeCommentStatement[] GenerateSummary(string summaryBody) + { + return new CodeCommentStatement[] { + new CodeCommentStatement("", true), + new CodeCommentStatement(summaryBody, true), + new CodeCommentStatement("", true) + }; + } + + private static bool IsVowel(char c) + { + switch (c) + { + case 'O': + case 'U': + case 'Y': + case 'A': + case 'E': + case 'I': + case 'o': + case 'u': + case 'y': + case 'a': + case 'e': + case 'i': + return true; + } + return false; + } + + internal static string PluraliseName(string name) + { + if ((name.EndsWith("x", StringComparison.OrdinalIgnoreCase) || name.EndsWith("ch", StringComparison.OrdinalIgnoreCase)) || (name.EndsWith("ss", StringComparison.OrdinalIgnoreCase) || name.EndsWith("sh", StringComparison.OrdinalIgnoreCase))) + { + name = name + "es"; + return name; + } + if ((name.EndsWith("y", StringComparison.OrdinalIgnoreCase) && (name.Length > 1)) && !IsVowel(name[name.Length - 2])) + { + name = name.Remove(name.Length - 1, 1); + name = name + "ies"; + return name; + } + if (!name.EndsWith("s", StringComparison.OrdinalIgnoreCase)) + { + name = name + "s"; + } + return name; + } + + internal string Normalise(string input) + { + if (string.IsNullOrEmpty(input)) + { + throw new ArgumentNullException("input"); + } + + var invalids = new string[] { "_", "-", ".", "$", "@", "*" }; + + input = input.Trim().ToLower(); + + foreach (var i in invalids) + { + input = input.Replace(i, " "); + } + + var correctCasedInput = VB.Strings.StrConv(input, VB.VbStrConv.ProperCase, 0); + + var correctCasedAsArray = correctCasedInput.Split(' ').Where(s => !string.IsNullOrEmpty(s)); + + //var firstItem = correctCasedAsArray[0]; + StringBuilder ret = new StringBuilder(); + var foundChar = false; + foreach (var item in correctCasedAsArray) + { + foreach (var c in item) + { + if (Char.IsLetter(c)) + { + ret.Append(c); + foundChar = true; + } + else if (Char.IsDigit(c) && foundChar) + { + ret.Append(c); + } + } + } + + if (string.IsNullOrEmpty(ret.ToString())) + { + throw new IndexOutOfRangeException("No valid characters found within the string being normalised"); + } + + return ret.ToString(); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/LINQtoUmbracoGenerator.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/LINQtoUmbracoGenerator.cs new file mode 100644 index 0000000000..56740458f2 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Code Builder/LINQtoUmbracoGenerator.cs @@ -0,0 +1,75 @@ + +/*************************************************************************** + +Copyright (c) Microsoft Corporation. All rights reserved. +This code is licensed under the Visual Studio SDK license terms. +THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. + +***************************************************************************/ + +using System; +using System.Runtime.InteropServices; +using System.CodeDom.Compiler; +using System.CodeDom; +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.Schema; +using Microsoft.Win32; +using Microsoft.VisualStudio.Shell; +using VSLangProj80; +using System.Xml.Linq; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + /// + /// This is the generator class. + /// When setting the 'Custom Tool' property of a C# or VB project item to "LINQtoumbracoGenerator", + /// the GenerateCode function will get called and will return the contents of the generated file + /// to the project system + /// + [ComVisible(true)] + [Guid("52B316AA-1997-4c81-9969-95404C09EEB4")] + [CodeGeneratorRegistration(typeof(LINQtoumbracoGenerator), "C# LINQ to umbraco Class Generator", vsContextGuids.vsContextGuidVCSProject, GeneratesDesignTimeSource = true)] + [CodeGeneratorRegistration(typeof(LINQtoumbracoGenerator), "VB LINQ to umbraco Class Generator", vsContextGuids.vsContextGuidVBProject, GeneratesDesignTimeSource = true)] + [ProvideObject(typeof(LINQtoumbracoGenerator))] + public class LINQtoumbracoGenerator : BaseCodeGeneratorWithSite + { +#pragma warning disable 0414 + //The name of this generator (use for 'Custom Tool' property of project item) + internal static string name = "LINQtoumbracoGenerator"; +#pragma warning restore 0414 + + /// + /// Function that builds the contents of the generated file based on the contents of the input file + /// + /// Content of the input file + /// Generated file as a byte array + protected override byte[] GenerateCode(string inputFileContent) + { + var args = new ClassGeneratorArgs() + { + Namespace = this.FileNameSpace, + Dtml = XDocument.Parse(inputFileContent), + Provider = this.GetCodeProvider() + }; + + var builder = new ClassGenerator(args); + + //this.GetVSProject().References.Add("umbraco.Linq.Core"); + //this.GetVSProject().References.Add("System.Core"); + //this.GetVSProject().References.Add("umbraco"); + + builder.GenerateCode(); + return builder.SaveForVs(); + } + + protected override string GetDefaultExtension() + { + return ".designer" + base.GetDefaultExtension(); + } + } +} \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj new file mode 100644 index 0000000000..b9e0f2c505 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj @@ -0,0 +1,163 @@ + + + Debug + 9.0.30729 + 2.0 + {461089E7-008E-4737-BA17-E1FCD1CC3D0E} + Library + umbraco.Linq.DTMetal.CodeBuilder + umbraco.Linq.DTMetal.CodeBuilder + $(VSSDK90Install)VisualStudioIntegration\Common\Source\CSharp\RegistrationAttributes + SAK + SAK + SAK + SAK + v3.5 + true + ..\Solution Items\umbraco-key.snk + + + true + false + .\bin\Debug\ + false + DEBUG;TRACE + 4 + bin\Debug\umbraco.Linq.DTMetal.CodeBuilder.xml + + + false + true + .\bin\Release\ + false + TRACE + 4 + + + + False + + + False + + + + + + + + + + + System + + + + 3.5 + + + System.Data + + + 3.0 + + + + System.XML + + + 3.5 + + + + + $(DevEnvDir)\VSLangProj2.dll + + + $(DevEnvDir)\VSLangProj80.dll + + + + + Properties\SolutionInfo.cs + + + + + RegistrationAttributes\CodeGeneratorRegistrationAttribute.cs + true + + + + + + + + + + Component + + + Form + + + InstallerProgress.cs + + + + True + True + Strings.resx + + + + + + DocTypeML.xsd + + + Properties\umbraco-key.snk + + + + + + + + + + + Designer + ResXFileCodeGenerator + Strings.Designer.cs + Umbraco.Linq.DTMetal.CodeBuilder + + + InstallerProgress.cs + + + + + true + true + + + true + bin\Debug - Fixed Version\ + DEBUG;TRACE;FIXEDVERSION + bin\Debug\Umbraco.Linq.DTMetal.CodeBuilder.xml + AnyCPU + true + GlobalSuppressions.cs + + + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj.user b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj.user new file mode 100644 index 0000000000..0d8b328f92 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj.user @@ -0,0 +1,20 @@ + + + Program + C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe + /ranu /rootsuffix Exp + + + Program + C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe + /ranu /rootsuffix Exp + + + ShowAllFiles + + + C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe + /ranu /rootsuffix Exp + Program + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj.vspscc b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DTMetal.CodeBuilder.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/DataTypeAttribute.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/DataTypeAttribute.cs new file mode 100644 index 0000000000..c0869ae225 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/DataTypeAttribute.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.Linq.DTMetal.CodeBuilder.DataType +{ + [global::System.AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)] + public sealed class DataTypeAttribute : Attribute + { + public DataTypeAttribute(string controlId) + { + this.ControlId = new Guid(controlId); + } + + public Guid ControlId { get; private set; } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/DataTypeRetyper.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/DataTypeRetyper.cs new file mode 100644 index 0000000000..dbacd3a49e --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/DataTypeRetyper.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.Linq.DTMetal.CodeBuilder.DataType +{ + public abstract class DataTypeRetyper + { + /// + /// Gets the .NET type of the DataType + /// + /// The type of the member. + public abstract Type MemberType { get; } + + /// + /// Creates the name for the retyped member. Overload if custom naming is required + /// + /// Name used for the standard implementation + /// baseName + MemberType.Name + public virtual string MemberName(string baseName) + { + return baseName + this.MemberType.Name; + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/YesNoRetyper.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/YesNoRetyper.cs new file mode 100644 index 0000000000..7ee0e04f4c --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DataType/YesNoRetyper.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.Linq.DTMetal.CodeBuilder.DataType +{ + /// + /// A converter for the Yes/ No DataType + /// + [DataType("38b352c1-e9f8-4fd8-9324-9a2eab06d97a")] + public sealed class YesNoRetyper : DataTypeRetyper + { + public override Type MemberType + { + get { return typeof(bool); } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocType.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocType.cs new file mode 100644 index 0000000000..9c57016517 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocType.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + public sealed class DocType + { + public int Id { get; set; } + public int ParentId { get; set; } + public string Name { get; set; } + public string Alias { get; set; } + public string Description { get; set; } + public string TypeName { get; set; } + + public List Properties { get; set; } + public List Associations { get; set; } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocTypeAssociation.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocTypeAssociation.cs new file mode 100644 index 0000000000..a79d9b3789 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocTypeAssociation.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + public sealed class DocTypeAssociation + { + public int AllowedId { get; set; } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocTypeProperty.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocTypeProperty.cs new file mode 100644 index 0000000000..3ba515d987 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/DocTypeProperty.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + public sealed class DocTypeProperty + { + public int Id { get; set; } + public string Name { get; set; } + public string Alias { get; set; } + public string Description { get; set; } + public bool Mandatory { get; set; } + public string RegularExpression { get; set; } + public Type DatabaseType { get; set; } + public Guid ControlId { get; set; } + public string TypeName { get; set; } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerHandler.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerHandler.cs new file mode 100644 index 0000000000..c25a35e563 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerHandler.cs @@ -0,0 +1,60 @@ +using System.ComponentModel; +using Microsoft.Win32; +using System.Windows.Forms; +using System.Globalization; + +namespace umbraco.Linq.DTMetal.CodeBuilder.Installer +{ + [RunInstaller(true)] + public class InstallerHandler : System.Configuration.Install.Installer + { + public override void Install(System.Collections.IDictionary stateSaver) + { + base.Install(stateSaver); + + var vsPath9 = GetVsPath9(); + var vsPath10 = GetVsPath10(); + var targetPath = Context.Parameters["TargetDir"]; + + if ((vsPath9 != null || vsPath10 != null) && targetPath != null) + { + var progress = new InstallerProgress(InstallMode.Install, vsPath9, vsPath10, targetPath); + MessageBoxOptions options = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ? MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading : 0; + if (progress.ShowDialog() != DialogResult.OK) + { + MessageBox.Show(Strings.InstallFailureMessage, "LINQ to umbraco Setup", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, options); + MessageBox.Show(progress.Error.ToString()); + } + } + } + + private static string GetVsPath9() + { + RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0", false); + if (key != null) + return (string)key.GetValue("InstallDir"); + return null; + } + + private static string GetVsPath10() + { + RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0", false); + if (key != null) + return (string)key.GetValue("InstallDir"); + return null; + } + + public override void Uninstall(System.Collections.IDictionary savedState) + { + base.Uninstall(savedState); + + var vsPath9 = GetVsPath9(); + var vsPath10 = GetVsPath10(); + if (vsPath9 != null || vsPath10 != null) + { + var progress = new InstallerProgress(InstallMode.Uninstall, vsPath9, vsPath10, null); + progress.ShowDialog(); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.Designer.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.Designer.cs new file mode 100644 index 0000000000..545ae7ba00 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.Designer.cs @@ -0,0 +1,84 @@ +namespace umbraco.Linq.DTMetal.CodeBuilder.Installer +{ + partial class InstallerProgress + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallerProgress)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.installWorker = new System.ComponentModel.BackgroundWorker(); + this.SuspendLayout(); + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.Name = "label1"; + // + // label2 + // + resources.ApplyResources(this.label2, "label2"); + this.label2.Name = "label2"; + // + // progressBar1 + // + resources.ApplyResources(this.progressBar1, "progressBar1"); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + // + // installWorker + // + this.installWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.installWorker_DoWork); + this.installWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.installWorker_RunWorkerCompleted); + // + // InstallerProgress + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ControlBox = false; + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InstallerProgress"; + this.Load += new System.EventHandler(this.InstallerProgress_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ProgressBar progressBar1; + private System.ComponentModel.BackgroundWorker installWorker; + } +} \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.cs new file mode 100644 index 0000000000..592958c4f7 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.cs @@ -0,0 +1,358 @@ +using System; +using System.ComponentModel; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Diagnostics; +using System.Reflection; +using System.Globalization; +using Microsoft.Win32; +using System.Linq; + +namespace umbraco.Linq.DTMetal.CodeBuilder.Installer +{ + public partial class InstallerProgress : Form + { + private const string generatorKey = "{52B316AA-1997-4c81-9969-95404C09EEB4}"; + private const string dtml = ".dtml"; + private const string clas = "LINQtoumbraco.DTML.1.0"; + private const string desc = "LINQ to umbraco Entity Mapping"; + + private InstallMode _mode; + private string _vs9Path; + private string _vs10Path; + private string _targetPath; + + internal InstallerProgress(InstallMode mode, string vs9Path, string vs10Path, string targetPath) + { + InitializeComponent(); + + _mode = mode; + _vs9Path = vs9Path; + _vs10Path = vs10Path; + _targetPath = targetPath; + } + + #region Events + private void installWorker_DoWork(object sender, DoWorkEventArgs e) + { + + switch (_mode) + { + case InstallMode.Install: + InstallVsTemplates(); + SetupRegistry(); + InstallDtmlXsd(); + ConfigVs(); + break; + case InstallMode.Uninstall: + UninstallVsTemplates(); + TearDownRegistry(); + UninstallDtmlXsd(); + ConfigVs(); + break; + default: + break; + } + } + + private void installWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + if (e.Error != null) + { + this.DialogResult = DialogResult.Cancel; + this.Error = e.Error; + } + else + { + this.DialogResult = DialogResult.OK; + } + } + public Exception Error { get; set; } + + private void InstallerProgress_Load(object sender, EventArgs e) + { + installWorker.RunWorkerAsync(); + } + #endregion + + #region Uninstall + private void UninstallDtmlXsd() + { + try + { + File.Delete(GetDtmlXsdPathVs9()); + } + catch { } + + try + { + File.Delete(GetDtmlXsdPathVs10()); + } + catch { } + } + + private void TearDownRegistry() + { + if(Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey) != null) + { + Registry.LocalMachine.DeleteSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey); + } + + if (Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0\CLSID\" + generatorKey) != null) + { + Registry.LocalMachine.DeleteSubKey(@"Software\Microsoft\VisualStudio\10.0\CLSID\" + generatorKey); + } + + if (Registry.ClassesRoot.OpenSubKey(dtml) != null) + { + Registry.ClassesRoot.DeleteSubKeyTree(dtml); + } + + if (Registry.ClassesRoot.OpenSubKey(clas) != null) + { + Registry.ClassesRoot.DeleteSubKeyTree(clas); + } + } + + private void UninstallVsTemplates() + { + if (!string.IsNullOrEmpty(_vs9Path)) + { + string csTgt = Path.Combine(_vs9Path, @"ItemTemplates\CSharp\1033\LINQtoumbracoCS.zip"); + string vbTgt = Path.Combine(_vs9Path, @"ItemTemplates\VisualBasic\1033\LINQtoumbracoVB.zip"); + + try + { + File.Delete(csTgt); + File.Delete(vbTgt); + } + catch { } + } + + if (!string.IsNullOrEmpty(_vs10Path)) + { + string csTgt = Path.Combine(_vs10Path, @"ItemTemplates\CSharp\1033\LINQtoumbracoCS.zip"); + string vbTgt = Path.Combine(_vs10Path, @"ItemTemplates\VisualBasic\1033\LINQtoumbracoVB.zip"); + + try + { + File.Delete(csTgt); + File.Delete(vbTgt); + } + catch { } + } + } + #endregion + + #region Install + private void InstallDtmlXsd() + { + var assembly = Assembly.GetExecutingAssembly(); + + // Load the XSD for DocTypeML. + string xsd; + using (Stream s = assembly.GetManifestResourceStream(assembly.GetName().Name + ".DocTypeML.xsd")) + { + using (StreamReader sr = new StreamReader(s)) + { + xsd = sr.ReadToEnd(); + } + } + + // Write the XSD to the Visual Studio folder with XML schemas. + if (!string.IsNullOrEmpty(_vs9Path)) + { + using (StreamWriter sw = File.CreateText(GetDtmlXsdPathVs9())) + { + sw.Write(xsd); + } + } + + if (!string.IsNullOrEmpty(_vs10Path)) + { + using (StreamWriter sw = File.CreateText(GetDtmlXsdPathVs10())) + { + sw.Write(xsd); + } + } + } + + private void SetupRegistry() + { + #region LINQtoumbracoGenerator Key + if (!string.IsNullOrEmpty(_vs9Path)) + { + RegistryKey genKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey); + genKey.SetValue("Assembly", Assembly.GetExecutingAssembly().FullName); //full name of the assembly which the generator is in + genKey.SetValue("Class", "umbraco.Linq.DTMetal.CodeBuilder.LINQtoumbracoGenerator"); //generator class + genKey.SetValue("InprocServer32", Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), @"system32\mscoree.dll")); + genKey.SetValue("ThreadingModel", "Both"); + genKey.Close(); + } + + if (!string.IsNullOrEmpty(_vs10Path)) + { + RegistryKey genKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\VisualStudio\10.0\CLSID\" + generatorKey); + genKey.SetValue("Assembly", Assembly.GetExecutingAssembly().FullName); //full name of the assembly which the generator is in + genKey.SetValue("Class", "umbraco.Linq.DTMetal.CodeBuilder.LINQtoumbracoGenerator"); //generator class + genKey.SetValue("InprocServer32", Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), @"system32\mscoree.dll")); + genKey.SetValue("ThreadingModel", "Both"); + genKey.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\.dtml + { + RegistryKey dtmlKey = Registry.ClassesRoot.CreateSubKey(dtml, RegistryKeyPermissionCheck.ReadWriteSubTree); + dtmlKey.SetValue(null, clas); + dtmlKey.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0 + { + RegistryKey kClas = Registry.ClassesRoot.CreateSubKey(clas, RegistryKeyPermissionCheck.ReadWriteSubTree); + kClas.SetValue(null, desc); + kClas.SetValue("AlwaysShowExt", "1"); + + #region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\DefaultIcon + { + RegistryKey kIcon = kClas.CreateSubKey("DefaultIcon"); + kIcon.SetValue(null, Path.Combine(_targetPath, @"DTMetal.exe") + ",0"); + kIcon.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell + { + RegistryKey kShel = kClas.CreateSubKey("shell"); + + #region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open + { + RegistryKey kOpen = kShel.CreateSubKey("Open"); + + #region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open\Command + { + RegistryKey kComm = kOpen.CreateSubKey("Command"); + kComm.SetValue(null, "\"" + Path.Combine(_vs9Path, "devenv.exe") + "\" /dde \"%1\""); + kComm.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open\ddeexec + { + RegistryKey kDdex = kOpen.CreateSubKey("ddeexec"); + kDdex.SetValue(null, "Open(\"%1\")"); + + #region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open\ddeexec\Application + { + RegistryKey kAppn = kDdex.CreateSubKey("Application"); + kAppn.SetValue(null, "VisualStudio.9.0"); + kAppn.Close(); + } + #endregion + + #region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open\ddeexec\Topic + { + RegistryKey kTopc = kDdex.CreateSubKey("Topic"); + kTopc.SetValue(null, "system"); + kTopc.Close(); + } + #endregion + + kDdex.Close(); + } + #endregion + + kOpen.Close(); + } + #endregion + + kShel.Close(); + } + #endregion + + kClas.Close(); + } + #endregion + } + + private void InstallVsTemplates() + { + if (!string.IsNullOrEmpty(_vs9Path)) + { + string csSrc = Path.Combine(_targetPath, @"Item packages\LINQtoumbracoCS.zip"); + string vbSrc = Path.Combine(_targetPath, @"Item packages\LINQtoumbracoVB.zip"); + string csTgt = Path.Combine(_vs9Path, @"ItemTemplates\CSharp\1033\LINQtoumbracoCS.zip"); + string vbTgt = Path.Combine(_vs9Path, @"ItemTemplates\VisualBasic\1033\LINQtoumbracoVB.zip"); + + if (!File.Exists(csTgt)) + File.Copy(csSrc, csTgt); + if (!File.Exists(vbTgt)) + File.Copy(vbSrc, vbTgt); + } + + if (!string.IsNullOrEmpty(_vs10Path)) + { + string csSrc = Path.Combine(_targetPath, @"Item packages\LINQtoumbracoCS.zip"); + string vbSrc = Path.Combine(_targetPath, @"Item packages\LINQtoumbracoVB.zip"); + string csTgt = Path.Combine(_vs10Path, @"ItemTemplates\CSharp\1033\LINQtoumbracoCS.zip"); + string vbTgt = Path.Combine(_vs10Path, @"ItemTemplates\VisualBasic\1033\LINQtoumbracoVB.zip"); + + if (!File.Exists(csTgt)) + File.Copy(csSrc, csTgt); + if (!File.Exists(vbTgt)) + File.Copy(vbSrc, vbTgt); + } + } + #endregion + + private string GetDtmlXsdPathVs9() + { + string path = _vs9Path; //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ + path = path.TrimEnd('\\'); //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE + path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7 + path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 9.0 + path = Path.Combine(path, "Xml"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml + path = Path.Combine(path, "Schemas"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas + path = Path.Combine(path, "DocTypeML.xsd"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas\DocTypeML.xsd + return path; + } + + private string GetDtmlXsdPathVs10() + { + string path = _vs10Path; //%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\ + path = path.TrimEnd('\\'); //%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE + path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 10.0\Common7 + path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 10.0 + path = Path.Combine(path, "Xml"); //%ProgramFiles%\Microsoft Visual Studio 10.0\Xml + path = Path.Combine(path, "Schemas"); //%ProgramFiles%\Microsoft Visual Studio 10.0\Xml\Schemas + path = Path.Combine(path, "DocTypeML.xsd"); //%ProgramFiles%\Microsoft Visual Studio 10.0\Xml\Schemas\DocTypeML.xsd + return path; + } + + private void ConfigVs() + { + if (!string.IsNullOrEmpty(_vs9Path)) + { + string devenv = Path.Combine(_vs9Path, "devenv.exe"); + Process p = Process.Start(devenv, "/InstallVSTemplates"); + p.WaitForExit(); + } + + if (!string.IsNullOrEmpty(_vs10Path)) + { + string devenv = Path.Combine(_vs10Path, "devenv.exe"); + Process p = Process.Start(devenv, "/InstallVSTemplates"); + p.WaitForExit(); + } + } + } + + internal enum InstallMode + { + Install, + Uninstall + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.resx b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.resx new file mode 100644 index 0000000000..326ed3486f --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Installer/InstallerProgress.resx @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + True + + + + 13, 13 + + + 278, 13 + + + 0 + + + LINQ to umbraco is configuring Visual Studio 2008/ 2010 + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + True + + + 38, 30 + + + 221, 13 + + + 1 + + + This may take a few minutes, please stand by + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 16, 61 + + + 271, 27 + + + 2 + + + progressBar1 + + + System.Windows.Forms.ProgressBar, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + 17, 17 + + + True + + + 6, 13 + + + 299, 100 + + + + CenterParent + + + LINQ to umbraco Installer Progress + + + installWorker + + + System.ComponentModel.BackgroundWorker, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + InstallerProgress + + + System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS.zip b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS.zip new file mode 100644 index 0000000000..10551ab2bc Binary files /dev/null and b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS.zip differ diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/LINQtoUmbracoCS.vstemplate b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/LINQtoUmbracoCS.vstemplate new file mode 100644 index 0000000000..fe487812d2 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/LINQtoUmbracoCS.vstemplate @@ -0,0 +1,31 @@ + + + LINQ to Umbraco File + An empty LINQ to Umbraco file + umbraco.ico + CSharp + 100 + DataClasses.dtml + 1 + Umbraco.Linq.Core.Designer + 3.5 + + + + + System + + + System.Core + + + Umbraco.Linq.Core + + + dtml.dtml + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/dtml.dtml b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/dtml.dtml new file mode 100644 index 0000000000..a75fd32030 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/dtml.dtml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/umbraco.ico b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/umbraco.ico new file mode 100644 index 0000000000..402cf9594e Binary files /dev/null and b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoCS/umbraco.ico differ diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB.zip b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB.zip new file mode 100644 index 0000000000..ee946fe0d7 Binary files /dev/null and b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB.zip differ diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/LINQtoUmbracoVB.vstemplate b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/LINQtoUmbracoVB.vstemplate new file mode 100644 index 0000000000..500ae504da --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/LINQtoUmbracoVB.vstemplate @@ -0,0 +1,31 @@ + + + LINQ to Umbraco File + An empty LINQ to Umbraco file + umbraco.ico + VisualBasic + 100 + DataClasses.dtml + 1 + Umbraco.Linq.Core.Designer + 3.5 + + + + + System + + + System.Core + + + Umbraco.Linq.Core + + + dtml.dtml + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/dtml.dtml b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/dtml.dtml new file mode 100644 index 0000000000..a75fd32030 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/dtml.dtml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/umbraco.ico b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/umbraco.ico new file mode 100644 index 0000000000..402cf9594e Binary files /dev/null and b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Item packages/LINQtoUmbracoVB/umbraco.ico differ diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Properties/AssemblyInfo.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..30a478a8b4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DTMetal.CodeBuilder")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("DTMetal.CodeBuilder")] +[assembly: AssemblyDelaySign(false)] diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Strings.Designer.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Strings.Designer.cs new file mode 100644 index 0000000000..5a0e899499 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Strings.Designer.cs @@ -0,0 +1,99 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3074 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace umbraco.Linq.DTMetal.CodeBuilder { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Strings { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Strings() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("umbraco.Linq.DTMetal.CodeBuilder.Strings", typeof(Strings).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Dtml file could not be located at \"{0}\". + /// + internal static string DtmlNotFound { + get { + return ResourceManager.GetString("DtmlNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The call to GetDefaultExtension() has failed due to the exception:. + /// + internal static string GetDefaultExtensionFailed { + get { + return ResourceManager.GetString("GetDefaultExtensionFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VS 2008 Setup Failed. + /// + internal static string InstallFailureMessage { + get { + return ResourceManager.GetString("InstallFailureMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The following validation errors occuring with the XML:. + /// + internal static string XsdValidationFailureHeading { + get { + return ResourceManager.GetString("XsdValidationFailureHeading", resourceCulture); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Strings.resx b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Strings.resx new file mode 100644 index 0000000000..3ffa0e3f56 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Strings.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The call to GetDefaultExtension() has failed due to the exception: + + + Dtml file could not be located at \"{0}\" + DtmlNotFound description + + + The following validation errors occuring with the XML: + XsdValidationFailureHeading description + + + VS 2008 Setup Failed + InstallFailureMessage description + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Switch.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Switch.cs new file mode 100644 index 0000000000..ff04115ae2 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Switch.cs @@ -0,0 +1,98 @@ +using System; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + public class Switch + { + public Switch(object o) + { + Obj = o; + } + + public object Obj { get; private set; } + + /// + /// Case statement + /// + /// Type of object + /// Action method to execute for case evaluation + /// + public Switch Case(Action a) + { + return Case(o => true, a, false); + } + + /// + /// Case statement + /// + /// Type of object + /// Action method to execute for case evaluation + /// if set to true fall through to next case statement. + /// + public Switch Case(Action a, bool fallThrough) + { + return Case(o => true, a, fallThrough); + } + + /// + /// Case statement + /// + /// Type of object + /// The funcation to eveluate against to object. + /// Action method to execute for case evaluation + /// + public Switch Case(Func c, Action a) + { + return Case(c, a, false); + } + + /// + /// Case statement + /// + /// Type of object + /// The funcation to eveluate against to object. + /// Action method to execute for case evaluation + /// if set to true fall through to next case statement. + /// + public Switch Case(Func c, Action a, bool fallThrough) + { + if (this == null) + { + return null; + } + else + { + if (this.Obj is T) + { + T t = (T)this.Obj; + if (c(t)) + { + a(t); + return fallThrough ? this : null; + } + } + } + + return this; + } + + /// + /// Defaults case + /// + /// Type of object + /// Action to perform + /// + public Switch Default(Action a) + { + if (this == null) + { + return null; + } + else + { + a((T)this.Obj); + return this; + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Wizard/CreateDtmlWizard.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Wizard/CreateDtmlWizard.cs new file mode 100644 index 0000000000..c43740e11a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.CodeBuilder/Wizard/CreateDtmlWizard.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.VisualStudio.TemplateWizard; +using EnvDTE; +using System.Windows.Forms; + +namespace umbraco.Linq.DTMetal.CodeBuilder +{ + public class CreateDtmlWizard : IWizard + { + private string _tool; + private bool _ok; + + #region IWizard Members + + public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem) + { + } + + public void ProjectFinishedGenerating(EnvDTE.Project project) + { + } + + public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem) + { + if (projectItem == null) + { + throw new ArgumentNullException("projectitem"); + } + + projectItem.Properties.Item("CustomTool").Value = _tool; + } + + public void RunFinished() + { + } + + public void RunStarted(object automationObject, Dictionary replacementsDictionary, WizardRunKind runKind, object[] customParams) + { + if (runKind == WizardRunKind.AsNewItem) + { + var dte = automationObject as _DTE; + var owner = new IDEWindow(new IntPtr(dte.MainWindow.HWnd)); + + _tool = replacementsDictionary["$CustomTool$"]; + string dataContextName = null; + if (replacementsDictionary.ContainsKey("$rootname$")) + { + dataContextName = replacementsDictionary["$rootname$"]; + if (dataContextName.EndsWith(".dtml", StringComparison.OrdinalIgnoreCase)) + { + dataContextName = dataContextName.Substring(0, dataContextName.Length - ".dtml".Length); + } + } + } + + throw new NotImplementedException(); + } + + public bool ShouldAddProjectItem(string filePath) + { + return _ok; + } + + #endregion + } + + + /// + /// Helper class for the Visual Studio IDE window. + /// + internal class IDEWindow : IWin32Window + { + /// + /// Handle to the IDE window. + /// + private IntPtr _handle; + + /// + /// Creates a new Visual Studio IDE window wrapper. + /// + /// Handle to the IDE window. + public IDEWindow(IntPtr handle) + { + _handle = handle; + } + + /// + /// Gets the handle to the IDE window. + /// + public IntPtr Handle + { + get { return _handle; } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/AuthoringTests.txt b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/AuthoringTests.txt new file mode 100644 index 0000000000..64bab9481d --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/AuthoringTests.txt @@ -0,0 +1,136 @@ +========================================================================== + Visual Studio Team System: Overview of Authoring and Running Tests +========================================================================== + +This overview describes the features for authoring and running tests in +Visual Studio Team System and Visual Studio Team Edition for Software Testers. + +Opening Tests +------------- +To open a test, open a test project or a test metadata file (a file with +extension .vsmdi) that contains the definition of the test. You can find +test projects and metadata files in Solution Explorer. + +Viewing Tests +------------- +To see which tests are available to you, open the Test View window. Or, +if you have installed Team Edition for Software Testers, you can also open +the Test List Editor window to view tests. + +To open the Test View window, click the Test menu, point to Windows, and +then click Test View. To open the Test List Editor window (if you have +installed Team Edition for Software Testers), click Test, point to Windows, +and then click Test List Editor. + +Running Tests +------------- +You can run tests from the Test View window and the Test List Editor window. +See Viewing Tests to learn how to open these windows. To run one or more +tests displayed in the Test View window, first select the tests in that +window; to select multiple tests, hold either the Shift or CTRL key while +clicking tests. Then click the Run Tests button in the Test View window +toolbar. + +If you have installed Visual Studio Team Edition for Software Testers, you can +also use the Test List Editor window to run tests. To run tests in Test List Editor, +select the check box next to each test that you want to run. Then click the +Run Tests button in the Test List Editor window toolbar. + +Viewing Test Results +-------------------- +When you run a test or a series of tests, the results of the test run will be +shown in the Test Results window. Each individual test in the run is shown on +a separate line so that you can see its status. The window contains an +embedded status bar in the top half of the window that provides you with +summary details of the complete test run. + +To see more detailed results for a particular test result, double-click it in +the Test Results window. This opens a window that provides more information +about the particular test result, such as any specific error messages returned +by the test. + +Changing the way that tests are run +----------------------------------- +Each time you run one or more tests, a collection of settings is used to +determine how those tests are run. These settings are contained in a “test +run configuration” file. + +Here is a partial list of the changes you can make with a test run +configuration file: + + - Change the naming scheme for each test run. + - Change the test controller that the tests are run on so that you can run + tests remotely. + - Gather code coverage data for the code being tested so that you can see + which lines of code are covered by your tests. + - Enable and disable test deployment. + - Specify additional files to deploy before tests are run. + - Select a different host, ASP.NET, for running ASP.NET unit tests. + - Select a different host, the smart device test host, for running smart device unit tests. + - Set various properties for the test agents that run your tests. + - Run custom scripts at the start and end of each test run so that you can + set up the test environment exactly as required each time tests are run. + - Set time limits for tests and test runs. + - Set the browser mix and the number of times to repeat Web tests in the + test run. + +By default, a test run configuration file is created whenever you create a +new test project. You make changes to this file by double-clicking it in +Solution Explorer and then changing its settings. (Test run configuration +files have the extension .testrunconfig.) + +A solution can contain multiple test run configuration files. Only one of +those files, known as the “Active” test run configuration file, is used to +determine the settings that are currently used for test runs. You select +the active test run configuration by clicking Select Active Test Run +Configuration on the Test menu. + +------------------------------------------------------------------------------- + +Test Types +---------- +Using Visual Studio Team Edition for Software Testers, you can create a number +of different test types: + +Unit test: Use a unit test to create a programmatic test in C++, Visual C# or +Visual Basic that exercises source code. A unit test calls the methods of a +class, passing suitable parameters, and verifies that the returned value is +what you expect. +There are three specialized variants of unit tests: + - Data-driven unit tests are created when you configure a unit test to be + called repeatedly for each row of a data source. The data from each row + is used by the unit test as input data. + - ASP.NET unit tests are unit tests that exercise code in an ASP.NET Web + application. + - Smart device unit tests are unit tests that are deployed to a smart device + or emulator and then executed by the smart device test host. + +Web Test: Web tests consist of an ordered series of HTTP requests that you +record in a browser session using Microsoft Internet Explorer. You can have +the test report specific details about the pages or sites it requests, such +as whether a particular page contains a specified string. + +Load Test: You use a load test to encapsulate non-manual tests, such as +unit, Web, and generic tests, and then run them simultaneously by using +virtual users. Running these tests under load generates test results, +including performance and other counters, in tables and in graphs. + +Generic test: A generic test is an existing program wrapped to function as a +test in Visual Studio. The following are examples of tests or programs that +you can turn into generic tests: + - An existing test that uses process exit codes to communicate whether the + test passed or failed. 0 indicates passing and any other value indicates + a failure. + - A general program to obtain specific functionality during a test scenario. + - A test or program that uses a special XML file (called a “summary results + file”), to communicate detailed results. + +Manual test: The manual test type is used when the test tasks are to be +completed by a test engineer as opposed to an automated script. + +Ordered test: Use an ordered test to execute a set of tests in an order you +specify. + +------------------------------------------------------------------------------- + + diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj new file mode 100644 index 0000000000..eafeff4af2 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj @@ -0,0 +1,108 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {85CA72D8-7095-4EB1-8997-A190667C723C} + Library + Properties + umbraco.Linq.DTMetal.Engine.Tests + umbraco.Linq.DTMetal.Engine.Tests + v3.5 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\Debug - Fixed Version\ + DEBUG;TRACE + full + AnyCPU + true + GlobalSuppressions.cs + prompt + + + + + + 3.5 + + + + 3.5 + + + + 3.5 + + + False + ..\..\..\dep\Reference Assemblies\Mocking\TypeMock.dll + + + False + ..\..\..\dep\Reference Assemblies\Mocking\Typemock.ArrangeActAssert.Dll + + + False + ..\..\..\dep\Reference Assemblies\Umbraco\umbraco.DataLayer.dll + + + + + Properties\SolutionInfo.cs + + + + + + + + + + + + {31CAEC36-0C3D-4D69-B092-84866811EA07} + Core + + + {461089E7-008E-4737-BA17-E1FCD1CC3D0E} + DTMetal.CodeBuilder + + + {B151A571-D2F7-47DD-AFD6-C2C34ECA845B} + DTMetal.Engine + + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj.user b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj.user new file mode 100644 index 0000000000..5c2d6e6a78 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj.user @@ -0,0 +1,5 @@ + + + ShowAllFiles + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj.vspscc b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DTMetal.Engine.Tests.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DocTypeMarkupLanguageBuilderTests.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DocTypeMarkupLanguageBuilderTests.cs new file mode 100644 index 0000000000..a98d790347 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DocTypeMarkupLanguageBuilderTests.cs @@ -0,0 +1,194 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using System.Xml.Linq; +using umbraco.Linq.DTMetal.CodeBuilder; + +namespace umbraco.Linq.DTMetal.Engine.Tests +{ + /// + /// Summary description for DocTypeMarkupLanguageBuilderTests + /// + [TestClass] + public class DocTypeMarkupLanguageBuilderTests + { + [TestMethod] + [Isolated] + [ExpectedException(typeof(ArgumentNullException))] + public void DocTypeMarkupLanguageBuilderTest_Constructor() + { + var dtmlGen = new DocTypeMarkupLanguageBuilder(null, string.Empty, false); + } + + [TestMethod, Isolated] + public void DocTypeMarkupLanguageBuilderTest_XmlValidates() + { + var dtob = Isolate.Fake.Instance(Members.MustSpecifyReturnValues); + + Isolate.WhenCalled(() => dtob.DocumentTypes).WillReturn(new List + { + new DocType{ + Alias = "DocType1", + Name = "Document Type 1", + Description = "Document type 1 description", + Id = 1, + ParentId = -1, + Associations= new List(), + Properties = new List(), + } + }); + + var dtmlGen = new DocTypeMarkupLanguageBuilder(dtob.DocumentTypes, string.Empty, false); + + dtmlGen.BuildXml(); + + Assert.IsTrue(true); + } + + [TestMethod, Isolated] + public void DocTypeMarkupLanguageBuilderTest_DataContextName() + { + var dtob = Isolate.Fake.Instance(Members.MustSpecifyReturnValues); + + Isolate.WhenCalled(() => dtob.DocumentTypes).WillReturn(new List + { + new DocType{ + Alias = "DocType1", + Name = "Document Type 1", + Description = "Document Type 1 description", + Id = 1, + ParentId = -1, + Associations= null, + Properties = null, + } + }); + + var dtmlGen = new DocTypeMarkupLanguageBuilder(dtob.DocumentTypes, string.Empty, false); + dtmlGen.BuildXml(); + Assert.AreEqual("umbraco", (string)dtmlGen.DocTypeMarkupLanguage.Root.Attribute("DataContextName")); + + dtmlGen = new DocTypeMarkupLanguageBuilder(dtob.DocumentTypes, "Myumbraco", false); + dtmlGen.BuildXml(); + Assert.AreEqual("Myumbraco", (string)dtmlGen.DocTypeMarkupLanguage.Root.Attribute("DataContextName")); + } + + [TestMethod] + [Isolated] + public void DocTypeMarkupLanguageBuilderTest_SingleDocType() + { + var xmlDoc = XDocument.Parse(@" + + + 1 + Document Type 1 + DocType1 + Document Type 1 description + + + +"); + + var dtob = Isolate.Fake.Instance(Members.MustSpecifyReturnValues); + + Isolate.WhenCalled(() => dtob.DocumentTypes).WillReturn(new List + { + new DocType{ + Alias = "DocType1", + Name = "Document Type 1", + Description = "Document Type 1 description", + Id = 1, + ParentId = -1, + Associations= null, + Properties = null, + } + }); + + var dtmlGen = new DocTypeMarkupLanguageBuilder(dtob.DocumentTypes, string.Empty, false); + + Isolate.Verify.WasCalledWithAnyArguments(() => dtob.DocumentTypes.GetEnumerator()); + + dtmlGen.BuildXml(); + + Assert.AreEqual(xmlDoc.ToString(SaveOptions.None), dtmlGen.DocTypeMarkupLanguage.ToString(SaveOptions.None)); + } + + [TestMethod, Isolated] + public void DocTypeMarkupLanguageBuilderTest_DocTypeWithProperties() + { + var dtob = Isolate.Fake.Instance(Members.ReturnRecursiveFakes); + + Isolate.WhenCalled(() => dtob.DocumentTypes).WillReturn(new List + { + new DocType{ + Alias = "DocType1", + Name = "Document Type 1", + Description = "Document Type 1 description", + Id = 1, + ParentId = -1, + Associations= null, + Properties = new List{ + new DocTypeProperty{ + Alias = "Property1", + ControlId = new Guid("15e66384-3fb6-435e-8fc0-fa63b47f0f4c"), + DatabaseType= typeof(int), + Description = string.Empty, + Id = 1, + Mandatory = false, + Name = "Property 1" + } + }, + } + }); + + var dtmlGen = new DocTypeMarkupLanguageBuilder(dtob.DocumentTypes, string.Empty, false); + + dtmlGen.BuildXml(); + + Assert.IsNotNull(dtmlGen.DocTypeMarkupLanguage); + Assert.AreEqual(1, dtmlGen.DocTypeMarkupLanguage.Descendants("Properties").Count()); + + var propertiesXml = dtmlGen.DocTypeMarkupLanguage.Descendants("Properties").First(); + Assert.AreEqual("Property1", propertiesXml.Element("Property").Element("Alias").Value); + Assert.AreEqual(new Guid("15e66384-3fb6-435e-8fc0-fa63b47f0f4c").ToString(), propertiesXml.Element("Property").Element("ControlId").Value); + Assert.AreEqual(typeof(int).ToString(), propertiesXml.Element("Property").Element("Type").Value); + Assert.AreEqual(string.Empty, propertiesXml.Element("Property").Element("Description").Value); + Assert.AreEqual(1, (int)propertiesXml.Element("Property").Element("Id")); + Assert.AreEqual(false, (bool)propertiesXml.Element("Property").Element("Mandatory")); + Assert.AreEqual("Property 1", propertiesXml.Element("Property").Element("Name").Value); + } + + [TestMethod, Isolated] + public void DocTypeMarkupLanguageBuilderTest_DocTypeWithAssociations() + { + var dtob = Isolate.Fake.Instance(Members.MustSpecifyReturnValues); + + Isolate.WhenCalled(() => dtob.DocumentTypes).WillReturn(new List + { + new DocType{ + Alias = "DocType1", + Name = "Document Type 1", + Description = "Document Type 1 description", + Id = 1, + ParentId = -1, + Associations = new List{ + new DocTypeAssociation{ + AllowedId = 1 + } + }, + Properties = null, + } + }); + + var dtmlGen = new DocTypeMarkupLanguageBuilder(dtob.DocumentTypes, string.Empty, false); + dtmlGen.BuildXml(); + + Assert.AreEqual(1, dtmlGen.DocTypeMarkupLanguage.Descendants("Associations").Count()); + + var association = dtmlGen.DocTypeMarkupLanguage.Descendants("Associations").First(); + Assert.AreEqual(1, (int)association.Element("Association")); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DocTypeObjectBuilderTest.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DocTypeObjectBuilderTest.cs new file mode 100644 index 0000000000..fc781e932a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/DocTypeObjectBuilderTest.cs @@ -0,0 +1,362 @@ +using umbraco.Linq.DTMetal.Engine; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TypeMock.ArrangeActAssert; +using umbraco.DataLayer; +using System; +using TypeMock; +using System.Linq; +using umbraco.Linq.DTMetal.CodeBuilder; +namespace umbraco.Linq.DTMetal.Engine.Tests +{ + + + /// + ///This is a test class for DocTypeObjectBuilderTest and is intended + ///to contain all CodeCreatorTest Unit Tests + /// + [TestClass()] + public class DocTypeObjectBuilderTest + { + [TestMethod] + [Isolated] + public void LoadDocTypesTest_DbCalled() + { + ISqlHelper sql = Isolate.Fake.Instance(Members.ReturnRecursiveFakes); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(sql); + target.LoadDocTypes(); + Isolate.Verify.WasCalledWithAnyArguments(() => target.SqlHelper); + Isolate.Verify.WasCalledWithAnyArguments(() => sql.ExecuteReader(string.Empty)); + } + + [TestMethod] + [Isolated] + public void LoadDocTypesTest_ReaderAccessed() + { + var sql = Isolate.Fake.Instance(); + var reader = Isolate.Fake.Instance(); + + Isolate.WhenCalled(() => reader.HasRecords).WillReturn(true); + Isolate.WhenCalled(() => reader.Read()).WillReturn(false); + Isolate.WhenCalled(() => sql.ExecuteReader(string.Empty)).WillReturn(reader); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(sql); + target.LoadDocTypes(); + + Isolate.Verify.WasCalledWithAnyArguments(() => reader.HasRecords); + Isolate.Verify.WasCalledWithExactArguments(() => reader.Read()); + } + + [TestMethod()] + [Isolated] + public void LoadDocTypesTest_CreateDocType() + { + ISqlHelper fakeSql = Isolate.Fake.Instance(Members.CallOriginal); + + IRecordsReader fakeReader = Isolate.Fake.Instance(); + + var dtGuid = Guid.NewGuid(); + + //get the data for the DT + Isolate.WhenCalled(() => fakeReader.HasRecords).WillReturn(true); + Isolate.WhenCalled(() => fakeReader.Read()).WillReturn(true); + Isolate.WhenCalled(() => fakeReader.Read()).CallOriginal(); + Isolate.WhenCalled(() => fakeReader.GetId()).WillReturn(1); + Isolate.WhenCalled(() => fakeReader.GetName()).WillReturn("Name"); + Isolate.WhenCalled(() => fakeReader.GetDescription()).WillReturn("Description"); + Isolate.WhenCalled(() => fakeReader.GetAlias()).WillReturn("Alias"); + Isolate.WhenCalled(() => fakeReader.GetParentId()).WillReturn(-1); + Isolate.WhenCalled(() => fakeSql.ExecuteReader(string.Empty)).WillReturn(fakeReader); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(fakeSql); + target.LoadDocTypes(); + + Assert.IsNotNull(target.DocumentTypes); + Assert.AreEqual(target.DocumentTypes.Count, 1); + + Isolate.Verify.WasCalledWithExactArguments(() => target.BuildDocumentType(fakeReader)); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetAlias()); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetParentId()); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetDescription()); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetName()); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetId()); + + var dt = target.DocumentTypes[0]; + Assert.AreEqual("Alias", dt.Alias); + Assert.AreEqual("Description", dt.Description); + Assert.AreEqual(1, dt.Id); + Assert.AreEqual("Name", dt.Name); + Assert.AreEqual(-1, dt.ParentId); + Assert.AreEqual(0, dt.Properties.Count); + } + + [TestMethod] + [Isolated] + public void LoadDocTypesTest_IntPropertyMapping() + { + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + + var intReader = Isolate.Fake.Instance(); + Isolate.WhenCalled(() => intReader.GetDbType()).WillReturn("Integer"); + var intProp = target.BuildProperty(intReader); + Assert.AreEqual(typeof(int), intProp.DatabaseType); + } + + [TestMethod, Isolated] + public void LoadDocTypesTest_NtextPropertyMapping() + { + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + var ntextReader = Isolate.Fake.Instance(); + Isolate.WhenCalled(() => ntextReader.GetDbType()).WillReturn("Ntext"); + var ntextProp = target.BuildProperty(ntextReader); + Assert.AreEqual(typeof(string), ntextProp.DatabaseType); + } + + [TestMethod, Isolated] + public void LoadDocTypesTest_NvarcharPropertyMapping() + { + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + var varcharReader = Isolate.Fake.Instance(); + Isolate.WhenCalled(() => varcharReader.GetDbType()).WillReturn("Nvarchar"); + var varcharProp = target.BuildProperty(varcharReader); + Assert.AreEqual(typeof(string), varcharProp.DatabaseType); + } + + [TestMethod, Isolated] + public void LoadDocTypesTest_DatePropertyMapping() + { + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + var dateReader = Isolate.Fake.Instance(); + Isolate.WhenCalled(() => dateReader.GetDbType()).WillReturn("Date"); + var dateProp = target.BuildProperty(dateReader); + Assert.AreEqual(typeof(DateTime), dateProp.DatabaseType); + } + + [TestMethod, Isolated] + public void LoadDocTypesTest_ObjectPropertyMapping() + { + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + var objReader = Isolate.Fake.Instance(); + Isolate.WhenCalled(() => objReader.GetDbType()).WillReturn("Something undefined"); + var objProp = target.BuildProperty(objReader); + Assert.AreEqual(typeof(object), objProp.DatabaseType); + } + + [TestMethod] + [Isolated] + public void LoadDocTypesTest_DocTypeProperties() + { + ISqlHelper fakeSql = Isolate.Fake.Instance(Members.ReturnRecursiveFakes); + + IRecordsReader fakeReader = Isolate.Fake.Instance(); + + var dtGuid = Guid.NewGuid(); + + //get the data for the DT + Isolate.WhenCalled(() => fakeReader.HasRecords).WillReturn(true); + Isolate.WhenCalled(() => fakeReader.Read()).WillReturn(true); + Isolate.WhenCalled(() => fakeSql.ExecuteReader(string.Empty)).WillReturn(fakeReader); + Isolate.WhenCalled(() => fakeReader.GetId()).WillReturn(0); + Isolate.WhenCalled(() => fakeReader.Read()).WillReturnRepeat(true, 4).AndThen().CallOriginal(); + Isolate.WhenCalled(() => fakeReader.GetParentId()).WillReturn(-1); + + Isolate.WhenCalled(() => fakeReader.GetAlias()).WillReturn("Property1 Alias"); + Isolate.WhenCalled(() => fakeReader.GetString("RegularExpression")).WillReturn(string.Empty); + Isolate.WhenCalled(() => fakeReader.GetDbType()).WillReturn("Integer"); + Isolate.WhenCalled(() => fakeReader.GetDescription()).WillReturn("Property1 Description"); + Isolate.WhenCalled(() => fakeReader.GetId()).WillReturn(1); + Isolate.WhenCalled(() => fakeReader.GetName()).WillReturn("Property1"); + + Isolate.WhenCalled(() => fakeReader.GetString("RegularExpression")).WillReturn(string.Empty); + Isolate.WhenCalled(() => fakeReader.GetDbType()).WillReturn("Ntext"); + + Isolate.WhenCalled(() => fakeReader.GetString("RegularExpression")).WillReturn(string.Empty); + Isolate.WhenCalled(() => fakeReader.GetDbType()).WillReturn("Nvarchar"); + + Isolate.WhenCalled(() => fakeReader.GetString("RegularExpression")).WillReturn(string.Empty); + Isolate.WhenCalled(() => fakeReader.GetDbType()).WillReturn("Date"); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(fakeSql); + target.LoadDocTypes(); + + Isolate.Verify.WasCalledWithExactArguments(() => target.GetProperties(0)); + Isolate.Verify.WasCalledWithExactArguments(() => target.BuildProperty(fakeReader)); + + Isolate.Verify.WasCalledWithAnyArguments(() => fakeSql.ExecuteReader(string.Empty)); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetAlias()); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetDbType()); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetDescription()); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetName()); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetString("RegularExpression")); + Isolate.Verify.WasCalledWithExactArguments(() => fakeReader.GetId()); + + var dt = target.DocumentTypes[0]; + + Assert.IsNotNull(dt.Properties); + Assert.AreEqual(4, dt.Properties.Count); + + Assert.AreEqual("Property1 Alias", dt.Properties[0].Alias); + Assert.AreEqual(typeof(int), dt.Properties[0].DatabaseType); + Assert.AreEqual("Property1 Description", dt.Properties[0].Description); + Assert.AreEqual(1, dt.Properties[0].Id); + Assert.AreEqual(false, dt.Properties[0].Mandatory); + Assert.AreEqual("Property1", dt.Properties[0].Name); + Assert.AreEqual(string.Empty, dt.Properties[0].RegularExpression); + Assert.AreEqual(typeof(string), dt.Properties[1].DatabaseType); + Assert.AreEqual(typeof(string), dt.Properties[2].DatabaseType); + Assert.AreEqual(typeof(DateTime), dt.Properties[3].DatabaseType); + + } + + [TestMethod] + [Isolated] + public void LoadDocTypesTest_ParentIncluded() + { + ISqlHelper fakeSql = Isolate.Fake.Instance(Members.CallOriginal); + + IRecordsReader fakeReader = Isolate.Fake.Instance(); + + Isolate.WhenCalled(() => fakeReader.HasRecords).WillReturn(true); + Isolate.WhenCalled(() => fakeReader.Read()).WillReturnRepeat(true, 2).AndThen().CallOriginal(); + + Isolate.WhenCalled(() => fakeReader.GetId()).WillReturn(1); + Isolate.WhenCalled(() => fakeReader.GetParentId()).WillReturn(-1); + Isolate.WhenCalled(() => fakeReader.GetId()).WillReturn(2); + Isolate.WhenCalled(() => fakeReader.GetParentId()).WillReturn(1); + + Isolate.WhenCalled(() => fakeSql.ExecuteReader(string.Empty)).WillReturn(fakeReader); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(fakeSql); + Isolate.WhenCalled(() => target.GetProperties(0)).WillReturn(new System.Collections.Generic.List()); + Isolate.WhenCalled(() => target.BuildAssociations(0)).WillReturn(new System.Collections.Generic.List()); + + target.LoadDocTypes(); + + Assert.AreEqual(2, target.DocumentTypes.Count); + Assert.AreEqual(target.DocumentTypes[0].Id, target.DocumentTypes[1].ParentId); + } + + [TestMethod] + [Isolated] + public void LoadDocTypesTest_ParentNotIncluded() + { + ISqlHelper fakeSql = Isolate.Fake.Instance(Members.CallOriginal); + + IRecordsReader reader = Isolate.Fake.Instance(); + + Isolate.WhenCalled(() => reader.HasRecords).WillReturnRepeat(true, 2).AndThen().CallOriginal(); + Isolate.WhenCalled(() => reader.Read()).WillReturnRepeat(true, 2).AndThen().CallOriginal(); + Isolate.WhenCalled(() => reader.GetId()).WillReturn(2); + Isolate.WhenCalled(() => reader.GetParentId()).WillReturn(1); + + Isolate.WhenCalled(() => reader.GetId()).WillReturn(1); + Isolate.WhenCalled(() => reader.GetParentId()).WillReturn(-1); + + Isolate.WhenCalled(() => fakeSql.ExecuteReader(string.Empty)).WillReturn(reader); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(fakeSql); + Isolate.WhenCalled(() => target.GetProperties(0)).WillReturn(new System.Collections.Generic.List()); + Isolate.WhenCalled(() => target.BuildAssociations(0)).WillReturn(new System.Collections.Generic.List()); + + target.LoadDocTypes(); + + Assert.AreEqual(2, target.DocumentTypes.Count); + Assert.AreEqual(target.DocumentTypes[0].Id, target.DocumentTypes[1].ParentId); + + Isolate.Verify.WasCalledWithExactArguments(() => target.LoadParentDocType(1)); + } + + [TestMethod] + [Isolated] + [ExpectedException(typeof(IndexOutOfRangeException))] + public void LoadDocTypesTest_ParentNotExists() + { + ISqlHelper fakeSql = Isolate.Fake.Instance(Members.CallOriginal); + + IRecordsReader fakeReader = Isolate.Fake.Instance(); + + Isolate.WhenCalled(() => fakeReader.HasRecords).WillReturn(true); + Isolate.WhenCalled(() => fakeReader.HasRecords).CallOriginal(); + Isolate.WhenCalled(() => fakeReader.GetParentId()).WillReturn(1); + Isolate.WhenCalled(() => fakeReader.Read()).WillReturn(true); + Isolate.WhenCalled(() => fakeReader.Read()).CallOriginal(); + + Isolate.WhenCalled(() => fakeSql.ExecuteReader(string.Empty)).WillReturn(fakeReader); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(fakeSql); + + target.LoadDocTypes(); + + Isolate.Verify.WasCalledWithAnyArguments(() => target.LoadParentDocType(1)); + } + + [TestMethod] + [Isolated] + public void LoadDocTypesTest_GenerateAssociations() + { + var sql = Isolate.Fake.Instance(); + var reader = Isolate.Fake.Instance(); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(sql); + Isolate.WhenCalled(() => target.GetProperties(0)).WillReturn(new System.Collections.Generic.List()); + + Isolate.WhenCalled(() => sql.ExecuteReader(string.Empty)).WillReturn(reader); + + Isolate.WhenCalled(() => reader.HasRecords).WillReturn(true); + Isolate.WhenCalled(() => reader.Read()).WillReturnRepeat(true, 2); + Isolate.WhenCalled(() => reader.Read()).WillReturn(false); + + Isolate.WhenCalled(() => reader.GetInt("AllowedId")).WillReturn(1); + + target.LoadDocTypes(); + + Isolate.Verify.WasCalledWithExactArguments(() => target.BuildAssociations(1)); + + Assert.AreEqual(1, target.DocumentTypes.Count); + Assert.AreEqual(1, target.DocumentTypes[0].Associations.Count); + Assert.AreEqual(1, target.DocumentTypes[0].Associations[0].AllowedId); + } + + [TestMethod] + [Isolated] + public void LoadDocTypesTest_RecursiveParent() + { + ISqlHelper fakeSql = Isolate.Fake.Instance(Members.CallOriginal); + + IRecordsReader reader = Isolate.Fake.Instance(); + + Isolate.WhenCalled(() => reader.HasRecords).WillReturnRepeat(true, 3).AndThen().CallOriginal(); + Isolate.WhenCalled(() => reader.Read()).WillReturnRepeat(true, 3).AndThen().CallOriginal(); + Isolate.WhenCalled(() => reader.GetId()).WillReturn(2); + Isolate.WhenCalled(() => reader.GetParentId()).WillReturn(1); + + Isolate.WhenCalled(() => reader.GetId()).WillReturn(1); + Isolate.WhenCalled(() => reader.GetParentId()).WillReturn(3); + + Isolate.WhenCalled(() => reader.GetId()).WillReturn(3); + Isolate.WhenCalled(() => reader.GetParentId()).WillReturn(-1); + + Isolate.WhenCalled(() => fakeSql.ExecuteReader(string.Empty)).WillReturn(reader); + + DocTypeObjectBuilder target = new DocTypeObjectBuilder(string.Empty); + Isolate.WhenCalled(() => target.SqlHelper).WillReturn(fakeSql); + Isolate.WhenCalled(() => target.GetProperties(0)).WillReturn(new System.Collections.Generic.List()); + Isolate.WhenCalled(() => target.BuildAssociations(0)).WillReturn(new System.Collections.Generic.List()); + + target.LoadDocTypes(); + + Assert.AreEqual(3, target.DocumentTypes.Count); + Assert.AreEqual(target.DocumentTypes[0].Id, target.DocumentTypes[1].ParentId); + + Isolate.Verify.WasCalledWithExactArguments(() => target.LoadParentDocType(3)); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/Extensions.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/Extensions.cs new file mode 100644 index 0000000000..311ea18235 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/Extensions.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TypeMock.ArrangeActAssert; + +namespace umbraco.Linq.DTMetal.Engine.Tests +{ + public static class Extensions + { + public static ActionRepeater WillReturnRepeat(this IPublicNonVoidMethodHandler ret, TReturn value, int numberOfReturns) + { + for (var i = 0; i < numberOfReturns; i++) + ret.WillReturn(value); + + return new ActionRepeater(ret); + } + + public static ActionRepeater CallOriginalRepeat(this IPublicNonVoidMethodHandler ret, int numberOfReturns) + { + for (var i = 0; i < numberOfReturns; i++) + ret.CallOriginal(); + + return new ActionRepeater(ret); + } + } + + public class ActionRepeater + { + private IPublicNonVoidMethodHandler _actionRepeater; + public ActionRepeater(IPublicNonVoidMethodHandler actionRepeater) + { + _actionRepeater = actionRepeater; + } + + public IPublicNonVoidMethodHandler AndThen() + { + return _actionRepeater; + } + } +} + diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/Properties/AssemblyInfo.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..ad7442479a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +using System.Reflection; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Core")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("Core")] \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMLGenerator.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMLGenerator.cs new file mode 100644 index 0000000000..3cfc0ad55d --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMLGenerator.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; + +namespace umbraco.Linq.DTMetal.Engine +{ + public sealed class DTMLGenerator + { + private string fileExtension = ".dtml"; + + public string SavePath { get; private set; } + public string umbracoConnectionString { get; private set; } + public string DataContextName { get; private set; } + public bool DisablePluralization { get; set; } + + public DTMLGenerator(string savePath, string umbracoConnectionString, string dataContextName, bool disablePluralization) + { + if (string.IsNullOrEmpty(savePath)) + { + throw new ArgumentNullException("savePath"); + } + if (string.IsNullOrEmpty(umbracoConnectionString)) + { + throw new ArgumentNullException("umbracoConnectionString"); + } + + this.SavePath = savePath; + this.umbracoConnectionString = umbracoConnectionString; + this.DataContextName = dataContextName; + } + + public void GenerateDTMLFile() + { + using (var objBuilder = new DocTypeObjectBuilder(this.umbracoConnectionString)) + { + objBuilder.LoadDocTypes(); + + var dtmlGen = new DocTypeMarkupLanguageBuilder(objBuilder.DocumentTypes, this.DataContextName, this.DisablePluralization); + + dtmlGen.BuildXml(); + + dtmlGen.Save(Path.Combine(this.SavePath, (string.IsNullOrEmpty(this.DataContextName) ? "umbraco" : this.DataContextName) + fileExtension)); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj new file mode 100644 index 0000000000..49f3047547 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj @@ -0,0 +1,115 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {B151A571-D2F7-47DD-AFD6-C2C34ECA845B} + Library + Properties + umbraco.Linq.DTMetal.Engine + umbraco.Linq.DTMetal.Engine + v3.5 + 512 + SAK + SAK + SAK + SAK + false + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\Debug - Fixed Version\ + DEBUG;TRACE + full + AnyCPU + true + GlobalSuppressions.cs + prompt + + + + False + ..\..\..\dep\Reference Assemblies\Umbraco\Microsoft.ApplicationBlocks.Data.dll + + + + 3.5 + + + 3.5 + + + + + False + ..\..\..\dep\Reference Assemblies\Umbraco\umbraco.DataLayer.dll + + + + + Properties\SolutionInfo.cs + + + + + + + + + True + True + Settings.settings + + + + + DocTypeML.xsd + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {461089E7-008E-4737-BA17-E1FCD1CC3D0E} + DTMetal.CodeBuilder + + + + + + true + true + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj.user b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj.user new file mode 100644 index 0000000000..5c2d6e6a78 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj.user @@ -0,0 +1,5 @@ + + + ShowAllFiles + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj.vspscc b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DTMetal.Engine.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DocTypeMarkupLanguageBuilder.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DocTypeMarkupLanguageBuilder.cs new file mode 100644 index 0000000000..4320a12d9a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DocTypeMarkupLanguageBuilder.cs @@ -0,0 +1,145 @@ +using System.Collections.Generic; +using System.Xml.Linq; +using System; +using System.Linq; +using System.Text; +using System.Xml.Schema; +using umbraco.Linq.DTMetal.CodeBuilder; + +namespace umbraco.Linq.DTMetal.Engine +{ + internal sealed class DocTypeMarkupLanguageBuilder + { + private IEnumerable _theList; + private XDocument _theXml; + private const string DTML_XSD_PATH = "umbraco.Linq.DTMetal.Engine.DocTypeML.xsd"; + private string _dataContextName; + private bool _disablePluralization; + + public DocTypeMarkupLanguageBuilder(IEnumerable docTypes, string dataContextName, bool disablePluralization) + { + + if (docTypes == null) + { + throw new ArgumentNullException("docTypes"); + } + if (string.IsNullOrEmpty(dataContextName)) + { + dataContextName = "umbraco"; + } + + this._dataContextName = dataContextName; + this._theList = docTypes; + this._disablePluralization = disablePluralization; + } + + internal void BuildXml() + { + var root = new XElement("DocumentTypes", + new XAttribute("Serialization", "None"), + new XAttribute("DataContextName", this._dataContextName), + new XAttribute("PluralizeCollections", !this._disablePluralization), + this._theList.Select(dt => BuildDocTypeXml(dt)) + ); + + this._theXml = new XDocument(root); + + this.ValidateSchema(); + } + + private XElement BuildDocTypeXml(DocType dt) + { + var dtXml = new XElement("DocumentType", + new XAttribute("ParentId", dt.ParentId), + new XElement("Id", dt.Id), + new XElement("Name", dt.Name), + new XElement("Alias", dt.Alias), + new XElement("Description", dt.Description), + BuildPropertiesXml(dt.Properties), + BuildAssociationsXml(dt.Associations) + ); + + return dtXml; + } + + private XElement BuildAssociationsXml(List list) + { + var associationsNode = new XElement("Associations"); + if (list != null) + { + foreach (var item in list) + { + associationsNode.Add(new XElement("Association", item.AllowedId)); + } + } + return associationsNode; + } + + private XElement BuildPropertiesXml(List list) + { + var propertiesNode = new XElement("Properties"); + + if (list != null) + { + + propertiesNode.Add(list.Select(p => new XElement("Property", + new XElement("Id", p.Id), + new XElement("Name", p.Name), + new XElement("Alias", p.Alias), + new XElement("Mandatory", p.Mandatory), + new XElement("RegularExpression", p.RegularExpression), + new XElement("Type", p.DatabaseType), + new XElement("ControlId", p.ControlId.ToString()), + new XElement("Description", p.Description) + ) + ) + ); + } + + return propertiesNode; + } + + internal XDocument DocTypeMarkupLanguage + { + get + { + return this._theXml; + } + } + + internal void ValidateSchema() + { + if (this._theXml == null) + { + throw new NullReferenceException("DTML has not be generated yet"); + } + + XmlSchemaSet schemas = new XmlSchemaSet(); + //read the resorce for the XSD to validate against + schemas.Add("", System.Xml.XmlReader.Create(this.GetType().Assembly.GetManifestResourceStream(DTML_XSD_PATH))); + + //we'll have a list of all validation exceptions to put them to the screen + List exList = new List(); + + //some funky in-line event handler. Lambda loving goodness ;) + this._theXml.Validate(schemas, (o, e) => { exList.Add(e.Exception); }); + + if (exList.Count > 0) + { + //dump out the exception list + StringBuilder sb = new StringBuilder(); + sb.AppendLine("The following validation errors occuring with the XML:"); + foreach (var item in exList) + { + sb.AppendLine(" * " + item.Message + " - " + item.StackTrace); + } + throw new XmlSchemaException(sb.ToString()); + } + } + + public void Save(string outputFilePath) + { + this.DocTypeMarkupLanguage.Save(outputFilePath); + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DocTypeObjectBuilder.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DocTypeObjectBuilder.cs new file mode 100644 index 0000000000..d494a08e5a --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/DocTypeObjectBuilder.cs @@ -0,0 +1,203 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using umbraco.DataLayer; +using umbraco.Linq.DTMetal.CodeBuilder; + +namespace umbraco.Linq.DTMetal.Engine +{ + internal sealed class DocTypeObjectBuilder : IDisposable + { + private string queryDocTypes = @"SELECT [t0].[id] AS [Id], [t0].[uniqueID] AS [UniqueID], [t0].[text] AS [Name], [t1].[alias] AS [Alias], [t1].[description] AS [Description], [t1].[masterContentType] AS [ParentID] + FROM [umbracoNode] AS [t0] + INNER JOIN [cmsContentType] AS [t1] ON [t0].[id] = [t1].[nodeId] + WHERE [t0].[NodeObjectType] = @objectType "; + + private string queryProperty = @"SELECT [t0].[id] AS [Id], [t0].[Alias], [t0].[Name], [t0].[mandatory] AS [Mandatory], [t0].[validationRegExp] AS [RegularExpression], [t0].[Description], [t1].[dbType] AS [DbType], [t1].[controlId] AS [ControlId] + FROM [cmsPropertyType] AS [t0] + LEFT OUTER JOIN [cmsDataType] AS [t1] ON [t1].[nodeId] = [t0].[dataTypeId] + WHERE [t0].[contentTypeId] = @docTypeId + ORDER BY [t0].[id], [t1].[pk] "; + + private ISqlHelper _sqlHelper; + public ISqlHelper SqlHelper + { + get + { + if (_sqlHelper == null) + { + try + { + _sqlHelper = DataLayerHelper.CreateSqlHelper(this.connectionString); + } + catch + { + } + } + return _sqlHelper; + } + } + + private string connectionString; + + public List DocumentTypes { get; set; } + + public DocTypeObjectBuilder(string connString) + { + this.connectionString = connString; + this.DocumentTypes = new List(); + } + + internal void LoadDocTypes() + { + var docTypes = SqlHelper.ExecuteReader(queryDocTypes + "ORDER BY [t0].[id]", SqlHelper.CreateParameter("@objectType", umbraco.Linq.DTMetal.Engine.Properties.Settings.Default.DocTypeId)); + + if (docTypes.HasRecords) + { + while (docTypes.Read()) + { + DocType newDocType = BuildDocumentType(docTypes); + if (newDocType.ParentId > 0 && this.DocumentTypes.SingleOrDefault(p => p.Id == newDocType.ParentId) == null) + { + LoadParentDocType(newDocType.ParentId); + } + this.DocumentTypes.Add(newDocType); + } + } + + docTypes.Dispose(); + } + + internal DocType BuildDocumentType(IRecordsReader docTypes) + { + DocType newDocType = new DocType + { + Id = docTypes.GetId(), + Alias = docTypes.GetAlias(), + Description = docTypes.GetDescription(), + Name = docTypes.GetName(), + ParentId = docTypes.GetParentId(), + }; + + newDocType.Properties = GetProperties(newDocType.Id); + newDocType.Associations = BuildAssociations(newDocType.Id); + + return newDocType; + } + + internal void LoadParentDocType(int parentId) + { + var docType = + SqlHelper.ExecuteReader(queryDocTypes + " AND [t1].[MasterContentType] == @parentID", + SqlHelper.CreateParameter("@parentID", parentId), + SqlHelper.CreateParameter("@objectType", umbraco.Linq.DTMetal.Engine.Properties.Settings.Default.DocTypeId) + ); + + if (docType.HasRecords) + { + while (docType.Read()) + { + var dt = BuildDocumentType(docType); + if (dt.ParentId != -1 && this.DocumentTypes.SingleOrDefault(p => p.Id == dt.ParentId) == null) + { + LoadParentDocType(dt.ParentId); + } + this.DocumentTypes.Add(dt); + } + } + else + { + throw new IndexOutOfRangeException("ParentId of \'" + parentId + "\' does not exist within the database"); + } + + docType.Dispose(); + } + + internal List GetProperties(int docTypeId) + { + var properties = SqlHelper.ExecuteReader(queryProperty, SqlHelper.CreateParameter("@docTypeId", docTypeId)); + var builtProperties = new List(); + + if (properties.HasRecords) + { + while (properties.Read()) + { + var p = BuildProperty(properties); + builtProperties.Add(p); + } + } + + properties.Dispose(); + + return builtProperties; + } + + internal DocTypeProperty BuildProperty(IRecordsReader reader) + { + var p = new DocTypeProperty + { + Alias = reader.GetAlias(), + Description = reader.GetDescription(), + Id = reader.GetId(), + Mandatory = reader.GetBoolean("Mandatory"), + Name = reader.GetName(), + RegularExpression = reader.GetString("RegularExpression"), + ControlId = reader.GetGuid("ControlId") + }; + + switch (reader.GetDbType()) + { + case "Date": + p.DatabaseType = typeof(DateTime); + break; + case "Integer": + p.DatabaseType = typeof(int); + break; + case "Ntext": + case "Nvarchar": + p.DatabaseType = typeof(string); + break; + default: + p.DatabaseType = typeof(object); + break; + } + + return p; + } + + internal List BuildAssociations(int docTypeId) + { + var reader = + SqlHelper.ExecuteReader(@"SELECT [t0].[AllowedId] + FROM [cmsContentTypeAllowedContentType] AS [t0] + WHERE [t0].[Id] = @docTypeId", + SqlHelper.CreateParameter("@docTypeId", docTypeId) + ); + + var allowedChildren = new List(); + + if (reader.HasRecords) + { + while (reader.Read()) + { + allowedChildren.Add(new DocTypeAssociation + { + AllowedId = reader.GetInt("AllowedId") + }); + } + } + + return allowedChildren; + } + + #region IDisposable Members + + public void Dispose() + { + this.SqlHelper.Dispose(); + } + + #endregion + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Extensions.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Extensions.cs new file mode 100644 index 0000000000..9d5d8b24e5 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Extensions.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using umbraco.DataLayer; + +namespace umbraco.Linq.DTMetal.Engine +{ + public static class Extensions + { + public static string GetAlias(this IRecordsReader reader) + { + return reader.GetString("Alias"); + } + + public static string GetName(this IRecordsReader reader) + { + return reader.GetString("Name"); + } + + public static int GetId(this IRecordsReader reader) + { + return reader.GetInt("Id"); + } + + public static string GetDescription(this IRecordsReader reader) + { + return reader.GetString("Description"); + } + + public static string GetDbType(this IRecordsReader reader) + { + return reader.GetString("DbType"); + } + + public static int GetParentId(this IRecordsReader reader) + { + try + { + return reader.GetInt("ParentId"); + } + catch (NullReferenceException) + { + return 0; + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/GlobalSuppressions.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/GlobalSuppressions.cs new file mode 100644 index 0000000000..1dd02f1836 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/GlobalSuppressions.cs @@ -0,0 +1,11 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. +// +// To add a suppression to this file, right-click the message in the +// Error List, point to "Suppress Message(s)", and click +// "In Project Suppression File". +// You do not need to add suppressions to this file manually. + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco")] diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/AssemblyInfo.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..0b9a5b6f52 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/AssemblyInfo.cs @@ -0,0 +1,13 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DTMetal.Engine")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("DTMetal.Engine")] +[assembly: CLSCompliant(false)] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("umbraco.Linq.DTMetal.Engine.Tests")] \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/Settings.Designer.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..7672f86595 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/Settings.Designer.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3074 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace umbraco.Linq.DTMetal.Engine.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("a2cb7800-f571-4787-9638-bc48539a0efb")] + public string DocTypeId { + get { + return ((string)(this["DocTypeId"])); + } + } + } +} diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/Settings.settings b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/Settings.settings new file mode 100644 index 0000000000..1aa3ccae26 --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/Properties/Settings.settings @@ -0,0 +1,9 @@ + + + + + + a2cb7800-f571-4787-9638-bc48539a0efb + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/app.config b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/app.config new file mode 100644 index 0000000000..0703f4a7ca --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal.Engine/app.config @@ -0,0 +1,15 @@ + + + + +
+ + + + + + a2cb7800-f571-4787-9638-bc48539a0efb + + + + \ No newline at end of file diff --git a/LinqToUmbraco/src/umbraco.Linq/DTMetal/ArgsParser.cs b/LinqToUmbraco/src/umbraco.Linq/DTMetal/ArgsParser.cs new file mode 100644 index 0000000000..9b28c022cf --- /dev/null +++ b/LinqToUmbraco/src/umbraco.Linq/DTMetal/ArgsParser.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using System.IO; +using umbraco.Linq.DTMetal.CodeBuilder; + +namespace umbraco.Linq.DTMetal +{ + enum RunMode + { + Xml, Class, Help + } + + internal sealed class ArgsParser + { + public ArgsParser(string[] args) + { + Dictionary res = new Dictionary(); + + Regex r = new Regex(@"[-/](?