New Mocking Capabilities in JustMock Q3 2011 SP
Telerik JustMock received many new features in the service pack for the Q3 2011 release, enhancing the mocking framework’s impressive ability to mock almost everything. Let’s take a look at a few highlights of JustMock Q3 2011 SP.
Mock Inside a ThreadpoolMock objects can be accessed inside of another thread and work as expected.
var mockable = Mock.Create<Mockable>();
Mock.Arrange(() => mockable.IsMocked).Returns(true);
bool mocked = false;
var latch = new WaitLatch();
ThreadPool.QueueUserWorkItem(cookie =>
{
try
{
mocked = mockable.IsMocked;
}
finally
{
latch.Signal();
}
});
latch.Wait();
Assert.IsTrue(mocked); The callback for ThreadPool.QueueUserWorkItem accesses the mock object, and the expected value is returned.
Asserting Occurrence in Extension Method
You can now ensure occurrences for extension methods to your mocked objects.
var sequence = Mock.Create<IEnumerable<int>>(); Mock.Arrange(() => sequence.First()).Returns(1).OccursOnce(); int result = sequence.First(); Assert.AreEqual(1, result); Mock.Assert(sequence);
In this example, sequence.First() is only called once, passing the test.
IgnoreInstance in Fluent ExtensionsMehfuz Hossain’s article on Future Mocking with IgnoreInstance describes this feature added in JustMock Q3 2011, but you may have noticed he didn’t use the Fluent API. It is now present in these extensions, so the example in the original blog post can be written as follows:
var fakeUsed = Mock.Create<UsedClass>();
fakeUsed.Arrange(mock => mock.ReturnFive()).Returns(7).IgnoreInstance();
Assert.AreEqual(7, fakeUsed.ReturnFive());
Assert.AreEqual(7, new UsedClass().ReturnFive()); Whichever style you prefer, mocking tightly coupled class is simple with JustMock.
Invoke Call with Expression Argument with Dynamic ValueThis feature gives you granular control over an arrangement utilizing a lambda expression.
var repository = Mock.Create<IBookRepository>();
var service = new BookService(repository);
var expected = new Book { Title = "Adventures" };
Mock.Arrange(() => repository.GetWhere(book => book.Id == 1))
.Returns(expected)
.MustBeCalled();
var actual = service.GetSingleBook(1);
Assert.AreEqual(actual.Title, expected.Title); In this example, service.GetSingleBook(1) is calling its dependent repository with the expression: book => book.Id == id. The parameter ‘id’ is a dynamic value.
public class BookService
{
private IBookRepository repository;
public BookService(IBookRepository repository)
{
this.repository = repository;
}
public Book GetSingleBook(int id)
{
return repository.GetWhere(book => book.Id == id);
}
} JustMock will now match book.Id == 1 to book.Id == id when id is equal to one. The expression must match value types. For example, book.Id > 0 will never be called by service.GetSingleBook(1).
Better Access to Documentation
The Getting Started Guide and example projects are now found in the start menu under Telerik | JustMock.
These resources can help you find the solution to nearly any mocking scenario. The Getting Started Guide is the bulk of the English documentation. However, we view tests as documentation as well. That’s why the example projects provide a hands-on approach, unit testing JustMock itself.
The documentation is also available in Help3 for download in a separate ZIP file.
What’s Coming?Our Q1 2012 Webinars are just around the corner. If you attend the What’s New in Tools for Better Code webinar, you can see live demos of the features mentioned in this blog post and much, much, more. One lucky winner from the Just* webinar will receive a Telerik Ultimate Collection worth $1999. More importantly, you will sharpen your ninja skills to write better code!
Telerik OpenAccess SDK – MVC 3, RAD data binding and more
As a response to your constant requests for sample projects demonstrating the best practices of using OpenAccess ORM in web projects, we have released some of the new and updated samples before Q1 2012 so that you can benefit from them immediately.
MVC developers will be happy to know that along with the MVC 2 example “MVC Forum”, we are now offering two solutions demonstrating MVC 3 usage with Fluent API or an .rlinq Domain Model – whichever approach you prefer. In addition, you can see an implementation using the Razor view engine as an alternative of the default one. Find the samples in our new ASP.NET MVC category.
We have revised the best practice examples for ASP.NET applications and they are now merged into one sample solution, called Managing OpenAccess Context. There you can see three different approaches for managing your context – storing it in the Master page, in the HttpContext or implementing an HttpModule for it. We appreciate your feedback – which approach do you like the most and why?
To provide the RAD developers among you some insight on LINQ-based data binding with OpenAccess ORM, we have updated most of the old OQL-based OpenAccessDataSource samples to use the new OpenAccessLinqDataSource instead. Check out the Hierarchical RadGrid, Self-Referencing with RadTreeView, Cascading Delete and CRUD Operation samples, all under the ASP.NET category.
Get the latest build (2011.3.1320) of the OpenAccess SDK from the download page now and speed up the integration of OpenAccess in your solution! Feel free to provide any feedback or to request new samples according to your needs.
Introducing RadDiagnostics for Windows Phone
As part of the Telerik “Q1.2012 Beta” package for Windows Phone we are releasing a new set of "Application Building Blocks" components. You can find more info on the idea of Application Building Blocks here. Among these components is RadDiagnostics.
OverviewRadDiagnostcs component will enable you to receive crash reports, get specific debug and run-time information from your end users when an issue (ApplicationUnhandledException) in your application is encountered. When an exception occurs, a MessageBox dialog is displayed and users are asked to report the diagnostics data. The collected data contains rich information about the exception, device and runtime info. Optionally a screenshot of the current application state can be provided. Developers can also add custom data when an exception has occurred and to collect runtime logs.
We are already using this component in Telerik “Tasks” application for WindowsPhone and it has proved to be a very valuable helper in debugging and resolving application issues. I strongly recommend you to add such an error reporting component to all of your applications.
Here is how the default user experience for the end users looks like:
When users click on the “Yes” button they will be able to send an email message pre-filled with all the data collected from RadDiagnostics.
This is the default user experience. Developers can customize the displayed message and also have an option to skip the message, to get the data and to send it automatically to their own web service for analyzing (this requires additional development and is not provided out of the box).
The usage of the control is quite simple and intuitive:
RadDiagnostics diagnostics = new RadDiagnostics(); diagnostics.EmailTo = “myemail@mail.com”; diagnostics.Init();This initialization code should be added in the App constructor.
To create a custom action and to get notified when an exception has occurred, you can subscribe to the ExceptionOccured event:
radDiagnostics.ExceptionOccurred += new EventHandler<ExceptionOccurredEventArgs>(RadDiagnostics_ExceptionOccurred); private void RadDiagnostics_ExceptionOccurred(object sender, ExceptionOccurredEventArgs e) { //e.Cancel = true; setting Cancel to true will prevent the message box from displaying. // add any custom code here, like reporting to a custom web service //SendDiagnosticsToWebService((sender as RadDiagnostics).DiagnosticInfo); } Diagnostic DataYou are maybe now curious to see what data you will receive when an error is encountered. Here is a sample error report:
[StackTrace]:[
Navigation is not allowed when the task is not in the foreground. Error: -2147220990
at Microsoft.Phone.Scheduler.SystemNotificationInterop.CheckHr(Int32 hr)
at Microsoft.Phone.Scheduler.SystemNotificationInterop.CreateNotification(ScheduledAction action)
at Microsoft.Phone.Scheduler.ScheduledActionService.Add(ScheduledAction action)
at Telerik.WindowsPhone.Tasks.ApplicationHelpers.ScheduleMasterTileUpdateAgent()
at Telerik.WindowsPhone.Tasks.App.Application_Launching(Object sender, LaunchingEventArgs e)
at Microsoft.Phone.Shell.PhoneApplicationService.FireLaunching()
at Microsoft.Phone.Execution.NativeEmInterop.FireOnLaunching()
]
[OccurrenceDate]:[Tue, 31 Jan 2012 12:41:48 GMT]
[AppInstallDate]:[Sun, 29 Jan 2012 19:00:42 GMT]
[AppTotalRuns]:[4]
[AppRunsAfterLastUpdate]:[4]
[AppPreviousRunDate]:[1/29/2012 2:01:54 PM]
[AppVersion]:[1.33]
[Culture]:[en-US]
[CurrentPageSource]:[/Views/SyncProvidersList.xaml?SyncProviderId=1]
[NavigationStack]:[/Views/MainPage.xaml]
[DeviceManufacturer]:[HTC]
[DeviceModel]:[mwp6985]
[DeviceHardwareVersion]:[0003]
[DeviceFirmwareVersion]:[2305.13.20104.605]
[OSVersion]:[Microsoft Windows CE 7.10.7720]
[CLRVersion]:[3.7.11140.0]
[DeviceType]:[Device]
[NetworkType]:[Wireless80211]
[DeviceTotalMemory(Mb)]:[475.375]
[AppPeakMemoryUsage(Mb)]:[4.828125]
[AppCurrentMemoryUsage(Mb)]:[4.828125]
[IsoStorageAvailableSpace(Mb)]:[2909]
As you can see we are collecting a lot of data which will be useful for you when debugging the problem. If this is not sufficient enough RadDiagnostics can be used as a simple logger to collect any runtime info you are providing. Here is a simple usage of the logging feature:
radDiagnostics.AddDebugInfo(String.Format("filterData = {0}", filterDate));In order to keep the performance of your application high logs will contain only the last 1Mb of data. Please keep this in mind when using this feature.
Another cool feature (and my favorite one I must admit :)) of RadDiagnostics is how the mail Subject is composed. Apart from the obvious info – ApplicationName and ApplicationVersion – it contains the Hashcode of the Stack Trace!!! This allows you to group the mails you receive and see which error is occurring most often – thus seeing the top priority issues.
Here is how my inbox looks like for the Tasks application crash reports:
I hope that this component will be very useful for you as it is for us in Tasks application. Please give it a try during the beta period and let us know if you have suggestions for enhancements.
You can also find me on twitter @valiostoychev – I’ll be happy to discuss any feedback you have!
Naming Conventions in JustCode
Choosing appropriate identifiers for the constructs in your code provides better readability and maintainability. With the latest build of Telerik JustCode you can now easily set naming conventions for all your code elements.
Configuration and Supported languagesThese rules can be set for C# and VB.NET and are part of the Code Style section of the JustCode options dialog:
These options are part of the shared settings so you can share them per solution as well.
Naming RulesThere are seven types of rules that a user can choose from:
- camelCase
- PascalCase
- UPPER_UNDERSCORE
- lower_underscore
- Sentence_underscore
- PascalCase_Underscore
- camelCase_Underscore
You can also disable the naming convention for a specific construct. Just choose “Disabled” from the rules combo box.
WarningsJustCode will analyze every identifier in your solution and will show a warning if the name of the construct does not match the specified naming rule:
An appropriate fix will be available:
There are some cases, in which you would like to set two rules for a construct, so that JustCode will accept either one of them when analyzing the name of the construct.
Consider the following case, where you want to have constants that are Pascal Case as well as constants that are UPPER_UNDERSCORE_CASE:
JustCode is showing a warning that the second constant does not match the naming conventions, because the naming rule for constants is set to “PascalCase”. You can, however, specify a secondary rule. To do so, click on the “Add” button in the Naming Conventions section or choose from the available context menu “Add Secondary Rule”. Save the chosen setting and the analysis will be refreshed automatically. The warning will not be shown anymore:
JustCode does not only show warning if the identifier of a construct does not match the chosen rule, but also uses the Naming Conventions when generation new constructs:
The Naming Conventions are also used in the quick-fixes that JustCode suggests:
That’s it for today. If you are eager to put your hands on these new functionalities, you can give Telerik JustCode a try! We hope you like what you see, much more to come. Your feedback is welcome and appreciated. Write to us in forum or support.
What's Coming?Our Q1 2012 Webinars are just around the corner. If you attend the What’s New in Tools for Better Code webinar, you can see live demos of the features mentioned in this blog post and much, much, more. One lucky winner from the Just* webinar will receive a Telerik Ultimate Collection worth $1999. More importantly, you will sharpen your ninja skills to write better code!
Happy Coding!
The JustCode team
The Q1 2012 MVC Beta is here with new Area chart and galore of charting features
I am happy to announce the immediate availability of the Telerik MVC Extensions Q1 2012 Beta release! With it comes the longed-for Area chart type as well as a bunch of new features for the majority of the existing chart types supported by our MVC charting. We are also shipping a plethora of small and medium-sized features across all the Telerik MVC extensions, as well as formal support for the Chrome 16 and FireFox 10 browser versions.
I won't go into much detail about each and every new functionality delivered with the Beta and, consecutively, the upcoming official major release (due in a couple of weeks time), but I will surely underline the most important features from which the majority of the ASP.NET MVC developers will benefit.
New Area Chart TypeThis chart type accounts for one additional means to visualize your data by means of area shape. The area chart shores up all applicable features of the rest chart types.
Now the developers have the option to scale the charting series presentation against more than one value axis. You are free to choose two, three or more value axes - there is virtually no limit, it all depends on how and versus what measurements you would like to visualize the data.
This feature is supported for bar, line and area charts for now, and will be braced for scatter charts with the official Q1'12 release.
Plot Bands
Allow you to define visual lines that highlight an important section of the charting graph - oftentimes min/max threshold or range that is aimed to be achieved for a given period. This feature has actually been included since the Q3 2011 SP1 commercial release of the extensions, but the Q1'12 Beta marks its prime time in the Open Source MVC distribution.
Common for all ExtensionsTwo things are worthy to be mentioned here - improved support for MVC authorization scenarios and combined js file for all MVC extensions client features.
And here are the links that will direct you to all the available information concerning the Q1 2012 MVC Beta release:
Trial Files | Commercial Files | OS Files | Demos | Documentation | Release Notes
As always, do not cringe and tell us what you think about the Beta in the public MVC Beta forum. We are only days away from the next major Telerik DevTools release, and your opinion matters!
Also do not miss our Q1'12 webinar week, starting Feb 20th and book your seat now!
About the authorStefan Rahnev is the Unit Manager of the ASP.NET MVC Telerik Division. He has been working for the company since 2005, when he started out as a regular support officer. His next steps at Telerik took him through the positions of Technical Support Director, co-team leader in one of the ASP.NET AJAX teams and ASP.NET AJAX Unit Manager. Stefan’s main interests are web development, agile processes planning and management, client services and psychology.
Are you into ASP.NET MVC development? Download our MVC components now to cut back development time and boost your productivity!
Horizontal Scrolling in RadDataBoundListBox now available
RadDataBoundListBox has been continuously developed and extended with new features like Item Animations, CheckBoxes support, Data Virtualization support etc. We have also fine-tuned its performance so that it perfectly fits in an environment of limited memory and CPU resources what a mobile phone is. You can see here a real-world scenario based comparison between RadDataBoundListBox and a standard ListBox control putting both UI Virtualization approaches head to head.
With Q1 2012 Beta we are introducing an entirely new feature which also paves the way for a more complex and performance-optimized Wrap Virtualization Layout: Horizontal Scrolling. A nice example is available in our Demos app (source code in) that showcases this feature:
You may now ask what’s the common thing between Horizontal Scrolling and support for Wrap Layout? Well, with this Beta release we are introducing some major architectural changes in RadDataBoundListBox’ engine which give us more freedom to implement different UI virtualization approaches and layouts. These changes include an extraction of the whole UI virtualization mechanism into a so called Strategy class which is simply plugged into the control. In this way we can easily develop a Wrap Layout Virtualization strategy and also make it available as an option in the feature set of the control.
Following is a quick code-snippet enriched demonstration of how activating horizontal scrolling in RadDataBoundListBox is done. There is a new property called VirtualizationStrategyDefinition which basically represents a definition for a given UI strategy and also a set of properties for this strategy. Currently only instances of the StackVirtualizationStrategyDefinition class can be used in this context:
<telerikPrimitives:RadDataBoundListBox x:Name="radDataBoundListBox"> <telerikPrimitives:RadDataBoundListBox.VirtualizationStrategyDefinition> <telerikPrimitives:StackVirtualizationStrategyDefinition Orientation="Horizontal"/> </telerikPrimitives:RadDataBoundListBox.VirtualizationStrategyDefinition> </telerikPrimitives:RadDataBoundListBox>
As you can see, the StackVirtualizationStrategyDefinition exposes an Orientation property which is used to define whether RadDataBoundListBox will scroll vertically or horizontally.
In near future, you will also be able to define a WrapVirtualizationStrategyDefinition by using the same approach and have your DataBoundListBox position its visual items in a wrap mode.
You can find this new functionality in the RadControls for Windows Phone 7 Q1 2012 Beta package available for download from the Downloads section of your accounts.
XAMLflix continues with RadBarCode for Silverlight and WPF
Hello everyone and welcome back to XAMLflix with RadBarCode for Silverlight and WPF. What is XAMLflix you might ask? Well, it is Telerik’s way of teaching you how to use both new and existing controls from Telerik’s XAML suite. Each and every Thursday, we will provide a fresh batch of videos and sample projects highlighting a different control. Since our Silverlight and WPF share a common codebase and API, you only have to learn how to use these controls once! You can simply copy and paste the code between frameworks. If you are eager to get started then go ahead and download a trial of RadControls for Silverlight and WPF right now and follow along with the videos real-time.
Meet RadBarCode
The RadBarcode control can be used for automatic Barcode generation directly from a numeric or character data without the need of any Barcode font being installed in the end user’s PC. It can also generate many different types of Barcodes including those commonly used in point-of-sales industries.
- Getting Started with RadBarCode – In this video, we will dive into Visual Studio 2010 and begin with File -> New Project and use the RadBarCode Control. We will discuss adding references, to getting your Toolbox setup to finally adding a RadBarCode to our Silverlight Application. We will also discuss several properties that you can use to assist in developing highly flexible barcode applications. If you are brand new to RadBarCode then watch this video first! (source code)
- RadBarCode – Additional Formats In this video, we will discuss the various formats supported by RadBarCode out of the box and begin using several more popular Barcodes such as Code 128, PostNet, EAN-13 and UPC-A. If you want to become familiar with what barcodes we support and get a glimpse at using each one then this video is for you. (source code)
- RadBarCode – Sample Application In this video, we will create a sample application that demonstrates using the RadBarCode in an electronic catalog by using the RadBook control. Your user can flip pages easily in this real world simulation. I also discuss how easily you can print barcodes using RadBarCode and Silverlight 4’s built in PrintDocument class. (source code)
Wrap-Up
Thanks for reading and if you have any questions or comments then please let me know.
Also, keep watching the Telerik blogs as we are planning on releasing new videos for XAMLflix each and every week. You can download a trial of RadControls for Silverlight and WPF right now.
Find me on Twitter at : @mbcrump
Try the Hot Stuff – Telerik’s AJAX Q1 2012 Beta is Out!
Quick links: Play with the Beta Demos | Download the Beta | Check the full Release notes
Client-side binding for RadListView – RadListView now supports client-side binding with client-side HTML templates. The HTML templates are defined through the markup similarly to the server templates. jQuery is used for DOM operations.
Expand/Collapse and Drag-and-drop for RadOrgChart – Added with the previous version of RadControls for ASP.NET AJAX, we continue with the important functionalities of the RadOrgChart. Now your users will have the ability to collapse and expand the hierarchical tree, and this is achieved with a single property. Or if you need to re-organize the current structure, you can just drag a single item, or a whole tree of items, and drop it wherever you like.
Thumbnail Explorer Mode for RadFileExplorer – This feature offers a new way to display the files list in the selected folder resembling the Windows Explorer view. To enable the thumbnail explorer mode you need to set a single property. This mode is also the default one for the RadEditor Image Manager.
Export to Excel and Column Resizing and Show/Hide for RadTreeList – RadTreeList already provides the ability to export it to Pdf and from now on you will be able to export its data to Excel as well. And to make it more flexible and for better user experience, columns resizing and show/hide client-side functionalities are added to the RadTreeList features set. See Demos
New Format Sets drop down for RadEditor – These sets are used to apply formatting to elements and sections in the content of the editor. The format sets dropdown provided different groups. And you can add a custom format set directly through your markup. See Demos
To be getting regular updates on what’s new, subscribe to the ASP.NET AJAX Team blog feed, or keep an eye on it frequently. In the upcoming days the AJAX developers will blog about each of the new features in details and share interesting tips with you.
And last but not least, don’t forget to share your feedback with us on the Beta forum!
About the authorIana Tsolova is Unit Manager of Telerik’s ASP.NET AJAX division. She joined the company back in 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of theASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web developing, reading articles related to geography, wild nature and latest renewable energy technologies.
Announcing Application Building Blocks for Metro applications
With Telerik WindowsPhone Q1.2012 Beta release we are shipping the first parts of the new line of Telerik components – Application Building Blocks for Metro mobile applications. These components are created to target mobile Metro applications for Windows Phone 7 and for Windows 8/Rt at a later stage.
The tricky part in mobile development is that you have to think about development and promotion simultaneously.
The Marketplace is the primary distribution channel for your app and it has its logic and app’s success metrics. What’s cool is that there are a number of in-app tricks that you can do yourself that will influence the app’s overall success. What’s even cooler is that we have thought about these composite parts of your app instead of you.
With our experience in building professional Mobile applications we identified that there are a lot of mobile specific features that can be reusable and are essential parts of every professional application that will be distributed throughout mobile marketplaces. For every application we’ve been working on we needed to implement a set of common features like trial experience, rate the application reminders (for better marketplace rankings), error diagnostics, dynamic live tiles etc.. This is how we came to the decision to develop the following application building blocks which you can get out of the box and reuse in your applications:
- Error diagnostics – with this component you can receive crash reports, add specific debug information and get run-time information from your users when an issue in your application is encountered.
Read more about Rad Diagnostics
- Trial functionality– with this component you can adjust the trial functionality of your application. You can add application wide trial notifications, or feature specific trial functionality with a lot of configurable options for Trial Period or Trial Usages of the application or the paid feature.
Read more about RadTrialReminder
- Rate Application Reminder – with this component you can add a very important feature for reminding your users to rate your application thus increasing your marketplace presence.
Read more about RadRateApplicationReminder
- Live Tiles – live tiles in WP7 and WinRt are a great way expose application functionality onto user’s desktop. With this component you can easily create context specific dynamic tiles.
Read more about RadLiveTileHelper
Please give these components a try, while they are still in Beta, and let us know if you have any other feedback or ideas for other building blocks that will be useful for you.
You can also find me on twitter @valiostoychev – I’ll be happy to discuss any feedback you have!
RadControls for Windows Phone Q1 2012 Beta is here
Two weeks before the official Q1 2012 release we have prepared a Beta package containing all the new stuff that we have been working on the previous months for you to check out. There are some brand new components, as well as cool new features in RadSlideView, RadDataBoundListBox and RadBusyIndicator.
Let's start with the newborn components available in RadControls for Windows Phone Q1 2012 Beta:
- RadToolTip - this is a control that allows you to display a popup associated with a given visual element on your page. This popup may contain any type of information, like additional details or some hints. We have a pretty slick example of this new component in our Demos App with source code available
- RadRating - this one implements one of the most common scenarios: providing the end-user with the ability to evaluate something by choosing from a range of rating items associated with a given value
- Application Building Blocks - here we are taking a new direction by shipping a set of classes that will help you bring some essential scenarios to your own app without having to write so much code. The building blocks are inspired by the marketplace environment and requisite for the promotional stage of your app development cycle. RadDiagnostics, RadTrialReminder, LiveTileHelper and RadRateApplicationReminder are tools that easily integrate withing your app and help you gather feedback from your users, track application crashes, create secondary application tiles and implement trial-only available functionality.
Furthermore, we have prepared some upgrades for a couple of our existing controls that were both highly demanded by many of you and also greatly contribute to the big picture of a fully fledged control suite:
- RadDataBoundListBox now gets horizontal scrolling and a green light for Virtualized Wrap Layout (!) support (which we hope we will ship officially with Q1 2012)
- RadSlideView has been completely redesigned and revamped to provide greater performance, extended functionality like per-item Busy Indicator and optimized UI virtualization logic
- RadBusyIndicator has now an extended out-of-the-box animation set containing the standard WP7 OS dot-style animation
As you can see there is a lot of new stuff to play with. Since this is a Beta we are expecting your extensive feedback so go download the package from your account and check it out!
We have also left some new cool stuff as a surprise for the release. If you’d like to see all the new bits, make sure to sign-up for the Release Webinar Week, February 20-22. This 3-day event is packed with hour-long webinar sessions on the coolest new features shipping with the Q1 2012 release. One lucky winner from each webinar will leave with a Telerik Ultimate Collection license worth $1999. To enter the drawing and participate in the Q&A session, you must attend the live webinar.
Register at: http://www.telerik.com/support/webinars.aspx
Assert the order of expected calls over instances
How you assert through unit test that an user is authenticated before doing withdraw operation? You can surely verify a method is invoked as expected but if you want to ensure the order right then you might require a little more. JustMock lets you specify the order in which your setups should be executed. This helps you identify the exact way in which a particular logic is implemented.
To begin, lets consider the following context:
User wants to withdraw money from his account. Withdraw operation should validate the following goals:
- It should check if the user is authenticated
- It should get the balance for the authenticated user and check if the amount to be withdrawn is less than or equals to what is specified.
- Do the withdraw operation and return the remaining balance.
Now we have one IUserService interface
- public interface IUserSerivce
- {
- bool IsAuthenticated { get; }
- IUser GetUser();
- }
One IAccountService interface to process the accounts operation:
- public interface IAccountService
- {
- double Withdraw(double amount);
- double GetBalance(IUser user);
- }
The basic AccountRepository class with minimal implementation covering the above context looks like:
- public class AccountRepsotory
- {
- public AccountRepsotory(IUserSerivce userService, IAccountService accountService)
- {
- this.userService = userService;
- this.accountService = accountService;
- }
- public virtual double Withdraw(double amount)
- {
- if (userService.IsAuthenticated)
- {
- if (accountService.GetBalance(userService.GetUser()) >= amount)
- {
- return accountService.Withdraw(amount);
- }
- }
- throw new ArgumentException("TODO");
- }
- private readonly IUserSerivce userService;
- private readonly IAccountService accountService;
- }
Ensuring every step to be executed in an orderly manner , we just need to specify an extra InOrder option in Mock.Arrange that will otherwise fail the test during assert for any change of the expected execution order.
- [TestMethod]
- public void ShouldCheckUserAndBalanceInOrderWhenSpecificAmountIsWithdrawn()
- {
- var userService = Mock.Create<IUserSerivce>();
- var accountService = Mock.Create<IAccountService>();
- var user = Mock.Create<IUser>();
- Mock.Arrange(() => userService.IsAuthenticated).Returns(true).InOrder();
- Mock.Arrange(() => userService.GetUser()).Returns(user).InOrder();
- Mock.Arrange(() => accountService.GetBalance(user)).Returns(1000).InOrder();
- Mock.Arrange(() => accountService.Withdraw(Arg.AnyDouble)).Returns((amount) => 1000 - amount).InOrder();
- var repository = new AccountRepsotory(userService, accountService);
- Assert.AreEqual(990, repository.Withdraw(10));
- Mock.Assert(userService);
- Mock.Assert(accountService);
- }
Let’s remove the line# 13 from AccountRepository.Withdraw that yields:
- public virtual double Withdraw(double amount)
- {
- if (userService.IsAuthenticated)
- {
- return accountService.Withdraw(amount);
- }
- throw new ArgumentException("TODO");
- }
Since we broke the order, the test will fail with the following message:
Here one thing to notice that InOrder is applied to different mock instances within the test method scope that makes it effective in most practical and wide variety of scenarios. I have used Q3 SP build for the purpose (Also available via NuGet).
Hope that helps
Creating custom drag arrow in Silverlight
Since Q3 2011 we have changed the default drag API used. It allows creating more complex scenario as well as building MVVM friendly drag behaviors. However, it does not support drag arrow which, although not very popular feature is still used. Thus, when arrow was required, we have suggesting using legacy execution mechanism.
In this blog I will write how to create your own drag arrow using DragDropManager events. So, basically we will use AddDragInitialize, GiveFeedback and DragDropCompleted to create and control the arrow. We also use Popup to display it on the screen.
The arrow itself is located in Arrow class which derives from Content control and has its own template defined. Thus you can create custom arrow by simply adding new style to this control.
So, in order to use it you can just add the following lines in your code:
- Initialize ArrowService:
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
ArrowService.Initialize(this.RootVisual);
}
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
- Enable Arrow on drag:
ArrowService.DisplayDragArrow = true;
That way you have full control of arrow appearance and behavior. I hope you’ll like it.
Download Silverlight project
Telerik Windows Phone Customers Showcase Update and the State of the Marketplace in 2011
The showcase gallery featuring our customers Windows Phone apps just got updated with a few new applications. Check out the gallery here.
Looking at the appsfuse.com 100 Most Rated Publishers list on the Windows Phone Marketplace I was very happy to see one of our customers - Liquid Daffodil on number 10. Congrats!
And the other thing that I wanted to share with you today is this lovely retrospective infographic, posted by Brandon Watson, showing how the Windows Phone Marketplace, the developer mindshare and customer interest has evolved over in 2011.
Sharpen your .NET Ninja Skills…at Telerik's Q1 2012 Webinar Week
Hey telerik .net ninjas and ninjettes!
We can’t believe it either – another Telerik release is upon us. Our product group really keeps us, the marketing folks, on our toes at all times. For all of you who are keen on keeping your agendas up-to-date, here is a super early heads up on the Webinar Week schedule, so you can register and block off this time to brush up on all the cool new things coming from Telerik.
At each webinar we will draw a Telerik Ultimate Collection license worth $1999! The Ultimate Collection now contains our newest product – Kendo UI – everything you need to build sites and mobile apps with HTML5 and JavaScript. Participating in the Q&A session, as well as entering the drawing for the big prize, are privileges only for those attending the web events live ;)
Our Webinar Week schedule looks like:
Date Time Topic Mon, Feb 20 9:30 AM - 10:30 AM What’s New in XAML - RadControls for Silverlight and WPF 11:00 AM - 12:00 PM What’s New in Test Studio
12:30 PM - 1:30 PM What’s New in Data Tools – OpenAccess ORM
2:00 PM - 2:30 PM What’s New in RadControls for WinForms and Reporting Tues, Feb 21 9:30 AM - 10:30 AM What’s New in ASP.NET
11:00 AM - 12:00 PM What’s New in Tools for Better Code
12:30 PM - 1:30 PM What's New in Mobile - RadControls for Windows Phone Wed, Feb 22 9:30 AM - 10:30 AM What’s new in KendoUI 11:00 AM - 12:00 PM What’s new in Sitefinity 5.0
12:30 PM - 1:30 PM What’s new in TeamPulse .telerik-reTable-4 { border-collapse: collapse; border: solid 0px; font-family: Tahoma; } .telerik-reTable-4 tr.telerik-reTableHeaderRow-4 { border-width: 1.0pt 1.0pt 3.0pt 1.0pt; margin-top: 0in; margin-right: 0in; margin-bottom: 10.0pt; margin-left: 0in; line-height: 115%; font-size: 11.0pt; font-family: "Calibri" , "sans-serif"; width: 119.7pt; background: #4F81BD; padding: 0in 5.4pt 0in 5.4pt; color: #FFFFFF; } .telerik-reTable-4 td.telerik-reTableHeaderFirstCol-4 { padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 td.telerik-reTableHeaderLastCol-4 { padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 td.telerik-reTableHeaderOddCol-4 { padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 td.telerik-reTableHeaderEvenCol-4 { padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 tr.telerik-reTableOddRow-4 { border-width: 1pt; color: #666666; font-size: 10pt; vertical-align: top; border-bottom-style: solid; border-bottom-color: #4F81BD; } .telerik-reTable-4 tr.telerik-reTableEvenRow-4 { color: #666666; font-size: 10pt; vertical-align: top; } .telerik-reTable-4 td.telerik-reTableFirstCol-4 { border-width: 1pt; border-color: #4F81BD; padding: 0in 5.4pt 0in 5.4pt; border-bottom-style: solid; border-left-style: solid; } .telerik-reTable-4 td.telerik-reTableLastCol-4 { border-width: 1pt; border-color: #4F81BD; border-bottom-style: solid; border-right-style: solid; padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 td.telerik-reTableOddCol-4 { border-width: 1pt; border-color: #4F81BD; padding: 0in 5.4pt 0in 5.4pt; border-bottom-style: solid; } .telerik-reTable-4 td.telerik-reTableEvenCol-4 { border-width: 1pt; border-color: #4F81BD; padding: 0in 5.4pt 0in 5.4pt; border-bottom-style: solid; } .telerik-reTable-4 tr.telerik-reTableFooterRow-4 { color: #355C8C; background-color: #FFFFFF; font-size: 10pt; vertical-align: top; padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 td.telerik-reTableFooterFirstCol-4 { border-width: 1pt; border-color: #4F81BD; border-bottom-style: solid; border-left-style: solid; padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 td.telerik-reTableFooterLastCol-4 { border-width: 1pt; border-color: #4F81BD; border-bottom-style: solid; border-right-style: solid; padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 td.telerik-reTableFooterOddCol-4 { border-width: 1pt; border-color: #4F81BD; border-bottom-style: solid; padding: 0in 5.4pt 0in 5.4pt; } .telerik-reTable-4 td.telerik-reTableFooterEvenCol-4 { border-width: 1pt; border-color: #4F81BD; border-bottom-style: solid; padding: 0in 5.4pt 0in 5.4pt; } (All times are Eastern Standard Time)
Introducing XAMLflix - Starting with RadChartView for Silverlight and WPF
Happy Thursday to all you XAML-lovers out there! I'm back from the trenches with a new initiative aimed at teaching you how to use both new and existing controls from the Telerik RadControls for Silverlight and RadControls for WPF control suites. Starting today, every Thursday you'll be able to find a fresh batch of videos and sample projects highlighting a different control in a little series we're calling XAMLflix. The best part is that since we share a common codebase and API between our Silverlight and WPF suites you only have to learn how to use these controls once and can carry those skills over between frameworks. Pretty neat, right?
Say Hello, RadChartView
For anyone who has been with us for a bit, RadChartView actually first appeared in our Q3 2011 release with a beta tag stuck to it. Since then we've received a lot of feedback and wanted to use this as the pilot control for this new video content series, especially considering RadChartView goes official in our upcoming Q1 2012 release!
Rather than just direct you to the demos, while they are quite nice to look at, I wanted to give you a brief introduction to this new control with five videos meant to get you up and running. Without further delay, here's what we've got for today:
- Introducing RadChartView - A brief walkthrough how you can get up and running with nothing more than the Visual Studio designer and our designer widget for creating pre-defined charts. A must for anyone brand new to RadChartView! (Download the Project)
- Using RadCartesianChart - Walking through creating a new RadCartesianChart, including setting the chart Grid, picking out both horizontal and vertical axis, as well as defining a chart series and hooking it up to data. (Download the Project)
- Using RadPolarChart - Same as above, except this time with RadPolarChart! (Download the Project)
- Using the Pan and Zoom Behavior - Starting with a RadCertesianChart, see how quickly you can enable as well as customize the Pan and Zoom behavior. (Download the Project)
- Using the TrackBall Behavior - After a quick review of the new RadCartesianChart, see how 5 lines of XAML can add the TrackBall behavior to your charts and how quickly you can customize how data is displayed. (Download the Project)
So grab a cup of coffee and take these videos and their sample projects for a spin. And courtesy of our shared API and codebase the projects are replicated between Silverlight and WPF, so regardless of which framework you are on you can see how these work.
Stay tuned for the next installment of XAMLflix next week!
What’s New In The Latest JustCode Internal Build
In preparing for the upcoming major release of Telerik JustCode we published our first internal build for this year. Besides focusing on performance and memory footprint improvements we’ve listened to the users’ voice and implemented some of the features you’ve asked us for.
New In Test RunnerWe continued to improve our support for MbUnit and NUnit testing frameworks. Now we support the NUnit TheoryAttribute, and for MbUnit you will find support for:
Added New Filters In ToDo NavigatorAfter user’s request we added two more useful filters to the “Filter by” menu in the ToDo Navigator – “Current File” and “Current Project”:
With the latest build of JustCode you can now easily set naming conventions for all your code elements. Expect more on this topic in separate blog post that is to follow this one. Stay tuned!
Linq ConversionsNow you can use two new JustCode’s refactorings:
- Convert Linq To Foreach:
- Convert Linq to Extension Method Syntax:
We’ve added option (in JC Options\Code Style\C#\Using Directives) to put System.* namespaces on top when using refactoring "Organize and Add Missing Usings":
New In Formatter
- Implemented wrapping and unwrapping for anonymous class initializer:
Initial state:
Formatted state:
- Implemented wrapping and unwrapping for array arguments:
Initial state:
\
Formatted state:
- Implemented wrapping and unwrapping for assignments:
Initial state:
Formatted state:
- Implemented wrapping and unwrapping for LINQ clauses:
Initial state:
Formatted state:
Also you will find that we’ve improved code block formatter for object initializer, anonymous types and array initializer. The formatting results when using typing assistance are improved as well.
New Quick-FixesNow we have quick-fixes that will help you fix cases when there is a mismatch between return expression type and the member type:
- Quick-Fix: "Change Method Type" for return type - method type mismatch:
- Quick-Fix: "Change Member Type" for return type - member type mismatch:
- Quick-Fix: "Return Default Value" for return; in members that must return a value:
And this is not all - we fixed many issues thanks to your valuable feedback. We’d love if you give the latest internal build a try and let us know what you think!
The JustCode team
Scatter Your Data – Now!
The chart component for the Telerik Extensions for ASP.NET MVC is a rapidly expanding MVC component. Not only are we adding many new features, but we’re also increasing the available chart types. With the introduction of Q3 2011 we were able to start using two new chart types - Scatter and Scatter Line. Both types allow you to plot points anywhere on your chart area, as long as you provide each point with X and Y values. Let’s take a look at how you can implement these chart types, as well as take use of some new features introduced in Q3 2011 SP1.
Scattered Data EverywhereAs a starting point we can take a look at the scatter chart type and what awesome things we can do. One of the more important items with a chart is of course the data – why else would we have a chart? In an effort to include some short and sweet, but relevant, data I decided to go on Amazon.com and look up the Rating and Price of some DVD movies. Most of these ended up being a movie and its sequel, and we haven’t gone into genres yet, but I tried to get some variation in the titles! This can let me plot out Price against Rating, letting me see what movie gives me the most bang for my buck (after all, I want to be wise with my spending). So, what do we need to include in terms of the M portion of ASP.NET MVC? Title, Rating, and Price sound good to me:
public class MovieData { public string Title { get; set; } public double Rating { get; set; } public double Price { get; set; } }
I named this Model “MovieData”, which might not have me leaving with any awards for naming models, but it is still appropriate.
For this particular blog post I decided that I wanted to utilize Ajax binding with my chart, although you can definitely use server binding if you so prefer. So for the sake of me not forgetting to actually create some data (believe me, it’s happened too often ;)) let’s go ahead and just create a quick method in our controller that creates our list of movies. Now some of you might cringe at the idea of creating my list right in the controller, but this is for the sake of simplicity in this post, so put out those torches and lay down the pitchforks :) Here’s what this method looks like:
private List<MovieData> BuildMovieData() { List<MovieData> movies = new List<MovieData>(); movies.Add(new MovieData { Title = "Kung Fu Panda", Rating = 4.5, Price = 6.99 }); movies.Add(new MovieData { Title = "Kung Fu Panda 2", Rating = 4.5, Price = 14.99 }); movies.Add(new MovieData { Title = "Tron", Rating = 4.5, Price = 14.99 }); movies.Add(new MovieData { Title = "Tron: Legacy", Rating = 4.0, Price = 18.15 }); movies.Add(new MovieData { Title = "Harry Potter and the Deathly Hallows - Part 1", Rating = 4.0, Price = 7.47 }); movies.Add(new MovieData { Title = "Harry Potter and the Deathly Hallows - Part 2", Rating = 3.0, Price = 14.99 }); movies.Add(new MovieData { Title = "The Girl with the Dragon Tattoo", Rating = 4.0, Price = 11.99 }); return movies; }
So all this is doing is returning a list of our movies. While we’re in the controller, let’s create the ActionResult that will be used as our Ajax binding select, which will just return the Json representation of our data:
public ActionResult _SelectMovies() { return Json(BuildMovieData()); }
Now that we’re done with our Model and Controller, all we have left is the View. Let’s just create a basic chart without any series for now:
@(Html.Telerik().Chart<MovieData>() .Name("ScatterChart") .Title("DVD Price vs. Rating") .DataBinding(dataBinding => dataBinding.Ajax().Select("_SelectMovies", "Chart")) )
So we’ve set up our data binding, given our chart a name and a title. A good warm-up, but let’s actually create our scatter chart by defining our series:
@(Html.Telerik().Chart<MovieData>() .Name("ScatterChart") .Title("DVD Price vs. Rating") .DataBinding(dataBinding => dataBinding.Ajax().Select("_SelectMovies", "Chart")) .Series(series => { series.Scatter("Price", "Rating"); }) )
What you might notice here is that the strings I’m passing into the series are fields that I have defined in my Model, which is the way we let the scatter chart series know where to look for data. Here, the first parameter represents my X value – the DVD price – and the second parameter is my desired Y value – the DVD rating. I’ll show you what we can do with the Title (the last remaining property) later. If I were to run this as-is, we get the following:
While yes, our data is represented, there’s a whole lot missing to make this a bit more intuitive. A couple of things stick out right away. Does the Legend provide a lot of help here? Do we actually need to have the half step markers for the Rating? Can we quickly glance at which axis represents what? Sure, one axis goes from 1 to 5, but what if we were looking at the bargain bin and had a rating which could be as high as 20 (can’t be specific enough with rating nowadays)? Let’s tweak some things around in our code to make this chart look better.
First, we can fix the issues I pointed out regarding both the X and Y axis by utilizing the XAxis and YAxis functions:
@(Html.Telerik().Chart<MovieData>() .Name("ScatterChart") .Title("DVD Price vs. Rating") .DataBinding(dataBinding => dataBinding.Ajax().Select("_SelectMovies", "Chart")) .Series(series => { series.Scatter("Price", "Rating"); }) .XAxis(x => x .Title(title => title.Text("Price")) .Labels(labels => labels.Format("${0}")).Max(20)) .YAxis(y => y.Title(title => title.Text("Rating")).Max(5)) )
What I have done here for each of them is defined the title text, which was introduced in Q3 2011 SP1, which gives our users some context as to what they’re viewing. Additionally, since the X-axis does deal with price I took the liberty of formatting the labels to include a “$” sign in front of every label. Finally I set max values for each axis, since I know that my rating can go between 0 and 5 I set 5 as the maximum for the Y axis while the X axis got a 20 since none of the titles went over $20. Refreshing our page in our browser (or reloading it completely) gives us this chart:
Still a few things we can change, but we’re getting there. In terms of immediate looks let’s just disable the Legend
@(Html.Telerik().Chart<MovieData>() .Name("ScatterChart") .Title("DVD Price vs. Rating") .DataBinding(dataBinding => dataBinding.Ajax().Select("_SelectMovies", "Chart")) .Series(series => { series.Scatter("Price", "Rating"); }) .XAxis(x => x .Title(title => title.Text("Price")) .Labels(labels => labels.Format("${0}")).Max(20)) .YAxis(y => y.Title(title => title.Text("Rating")).Max(5)) .Legend(false) )
Much better! This chart is coming along nicely.
Now, remember how I promised you I’d use the Title field? I know almost all of you were on the edge of your seats wondering what fun adventures I had in store for this field ;) Well, I want to add some interactivity to the chart so let’s take use of tooltips and have them give us the title of the movie! This gives us a nice context as to which point represents what movie. To do this let’s create a template for our tooltips:
.Tooltip(tooltip => tooltip .Visible(true) .Template("<#= dataItem.Title #>"))
Keep in mind that these are all client-side templates, and we utilize the “<#= … #>” syntax to indicate the beginning and end of our template. Also, using dataItem in our template allows us to grab fields from our Model, so I just used dataItem.Title to render the title in each tooltip. We could also plug in some HTML and let the Tooltip be bold:
.Tooltip(tooltip => tooltip .Visible(true) .Template("<#= '<strong>' + dataItem.Title + '</strong>'#>"))
Since we already used double quotes to define the string of our template we’ll just use single quotes around our strong tags. Now when we refresh our page we get to find out what each point in our chart represents:
There we have it! A quick and easy implementation of the Scatter chart which allows us to see which movies provide us with the best rating per cost ratio.
Line Them UpWe of course want to take a look at the scatter line chart, which gives us the ability to have our scatter points connected via a line. With the previous example this would look really weird, but we could utilize another Model and approach it in a similar way as with our scatter chart. Sales per year works pretty well, so let’s create a Model that has year and sales fields. So, we have our Model:
public class YearData { public double Year { get; set; } public double Sales { get; set; } }
Then we have our data creation function in our controller (again, still your torches and pitch forks :)):
private List<YearData> BuildYearData() { List<YearData> sales = new List<YearData>(); sales.Add(new YearData { Year = 2007, Sales = 10000 }); sales.Add(new YearData { Year = 2008, Sales = 15000 }); sales.Add(new YearData { Year = 2009, Sales = 30000 }); sales.Add(new YearData { Year = 2010, Sales = 100000 }); sales.Add(new YearData { Year = 2011, Sales = 500000 }); return sales; }
Return this to our View as Json via our ActionResult so that we can use Ajax Binding:
public ActionResult _SelectSales() { return Json(BuildYearData()); }
Then we have the following chart declaration:
@(Html.Telerik().Chart<YearData>() .Name("ScatterLineChart") .Title("Sales per Year") .DataBinding(dataBinding => dataBinding.Ajax().Select("_SelectSales", "Chart")) .Series(series => { series.ScatterLine("Year", "Sales"); }) .XAxis(x => x .Title(title => title.Text("Year"))) .YAxis(y => y .Title(title => title.Text("Rating")) .Labels(labels => labels.Format("${0}"))) .Legend(false) .Tooltip(tooltip => tooltip .Visible(true) .Template("<#= '<strong>Year: </strong>' + dataItem.Year + ', <strong>Sales: </strong>$' + dataItem.Sales #>")) )
As we can see it’s pretty identical to what we had with the scatter chart type. The main difference is that in the series we use ScatterLine(“x”, “y”) instead of Scatter(“x”, “y”). We’re still passing the field names related to our desired X and Y values. We also removed the Max values from both the X and Y axis. Finally we expanded on the tooltip a little bit so we can use both the Year and Sales fields from our data item, allowing each point to have a detailed tooltip.
Final NotesIf you’re interested in more examples related to both the scatter and scatter line chart types I highly recommend checking out our demos
There are also several configuration options for defining the shape of the scatter points, as well as their style, which you can find more information about in our series documentation article.
Have you had a chance to utilize these chart types, or do you have good ideas for other sources of data? Feel free to share in the comments below!
Carl Bergenhem is an Enterprise Solutions Consultant at Telerik specializing in the ASP.NET AJAX and ASP.NET MVC products. He has always been interested in web development and has played around with various web technologies since he was a child. In his free time Carl enjoys soccer, running and playing his guitar.
New Video Series for Telerik RadCharts for Windows Phone 7
Hello everyone,
Today, we begin a new and exciting video series on Telerik’s RadCharts for Windows Phone 7. What is RadCharts you may ask? RadChart is intuitive and easy-to-use charts designed for the mobile environment. RadChart offers 20 chart series out-of-the-box and is designed for super-fast loading and real-time updates. The control’s intuitive object model and public API allow complex charts to be easily setup either in XAML or through code-behind.
Now that we know what RadChart is, let’s take a look at the roadmap for the series.
The Roadmap for the series:I’ve included the Roadmap for the series below as you may want to visit other sections as you learn about RadChart for Windows Phone 7. If you want a specific topic covered then please leave it in the comments below.
In order to fully understand the capabilities of the RadChart, we will start with the basics:
- How to create bar charts and the differences among them (Horizontal, Vertical, Stacked, etc) (source code)
- How to create line charts and the differences among them (Line, Spline, Area, Stacked Area)
- How to create pie, scatter and polar area charts
Then move into exciting new Chart Features such as:
- Live feed, Performance, Zoom and Pan and much much more.
And finally finish up with Dashboards
- How to use the chart with the gauge control with sales or customer data.
- Understanding the benefits of using the RadBulletGraph for financial data
Part 1: Creating Bar Charts and the differences amongst them.
In this part, we are creating the following 5 charts from scratch:
Bar Chart – One of the most common charts is the bar chart. The RadChart is easily able to visualize data points as bars. Each bar can have a different style which can encode arbitrary information or simply differentiate a bar from the others.
Bar Charts – Vertical: The bar series can be displayed vertically in both directions based on the values of the underlying data, notice how the vertical axis expands to provide negative values.
Bar Charts – Horizontal: The bar series can also be displayed horizontally in both directions with negative values extending to the left and positive values extending to the right.
Bar Charts – Stacked Vertical: This bar series can be stacked on each other with the CombineMode property of the axes. Since some bars can be shorter and also be behind other bars, the combine mode allows such cases to be avoided by arranging the bars as a stack.
Bar Charts – Stacked Horizontal: The stack combine mode also works for horizontally plotted series.
Wrap-UpGo ahead and check out these videos now and leave any comments or suggestions below.
Also, keep watching the Telerik blogs as we are planning on releasing more chart videos for Windows Phone 7 shortly. You can also download a trial right now.
RadControls for WinForms Q1 2012 Roadmap Revealed
2012 is already here and it is time to look forward to the first major release for this year – Q1 2012. As always, this release will be full of great new features that will make your applications even more professional. These features will be no surprise to anyone, just take a look at some of the most voted features in our Public Issue Tracker:
In order of appearance in the list, the features that we plan to introduce in Q1 2012 are:
- Printing support for RadScheduler and RadGridView. This feature will allow you to directly pass your RadScheduler/RadGridView instance to the printer. You will no longer have to export RadGridView to other formats (Excel, PDF, etc.) in order to print it. You will be also provided with a set of options that will allow for customizing the look of these two controls before processing this look to the printer.
- RadTimePicker control. Highly demanded, this control will come as a nice addition to your fill-in forms. Now the end-user will not only be to pick a date from the RadDateTimePicker, but it will also be able to pick the time from the drop-down of RadTimePicker.
This is what we will deliver for you in mid-February. February? That’s right. Our release cycle will be shifted with a month, so you will get the listed innovations even sooner than expected.
Happy coding!
Search in JustDecompile
There are many reasons why you would want to decompile an assembly with Telerik JustDecompile. Perhaps you’re curious about the inner workings of a particular reference, or maybe you’re looking for interesting techniques. But when you’re trying to solve an issue, you need to be able to quickly find what’s going wrong. Clues can range from a particular method call to an exception message, and a more robust method of searching was requested on the JustDecompile User Voice. We have answered the request in the latest version of JustDecompile.
The Search WindowThe new search window is accessible through the common shortcut for the find dialog: ctrl+f.
This dialog provides three different types of search methods: by type, by symbol, and full text. With full text search, you can search the currently selected assembly or through all loaded assemblies.
Perhaps I’m curious why a boolean is converted to ‘True’ instead of ‘true’. It’s a minor annoyance for xml writing, and knowing if there’s a way to control the manner in which the .NET framework converts this value could be handy for finding an elegant solution.
I select mscorlib in the navigation tree, then type “True” in the search box.
The results indicate that ‘True’ is hard-coded in ToString(), but I double-click the ToString() method in the grid to verify this information. JustDecompile automatically navigates to this member, and I know I will need to convert the string to lowercase myself.
Performing a full text search on all assemblies can be time consuming depending on the number and size of the loaded assemblies. Luckily, searching by type and by symbol are lightning fast! This is useful when you know the name of the type or member. These searches work the same way: type the symbol or type in the search box, and JustDecompile automatically searches the loaded assemblies.
I needed to find a particular member with a name similar to ‘boxed’. As I started typing, JustDecompile created the list and began filtering it. The final result contained the member I was searching for: System.Lazy`1.m_boxed.
What’s NextWe are headed toward the Q1 2012 release of JustDecompile, and you can be assured that we will continue to add features you’ve requested on User Voice. The site is easy to access from within JustDecompile; just click the “Suggest Feature…” button in the upper-right corner.
Happy Decompiling!
The JustDecompile team