Accessing Non-Public Member of Abstract Base Classes in Unit Tests

Given you have an abstract base class with non-public member, and a derived class with other non-public member too. Now you want to unit-test some of the non-public member (methods) of the derived class. Prior the call of the method of the derived class, you need to set some non-public …

Disable Control-Buttons of RadGridView

Using Telerik’s RadGridView, one can connect the add, update, cancel and delete command to RadButtons by setting the Command=”telerik:RadGridViewCommands….” properties of the buttons and link to the grid by setting the CommandTarget=”{Binding ElementName=GridViewName}” property. For some reasons, I needed to disable the buttons, depending on the rights the currently logged …

Silverlight Unit Test Headwords

At the time of writing, creating unit tests for Silverlight is not as smooth and easy as it is for .NET assemblies. My experiences base on the Silverlight toolkit published on Codeplex silverlight.codeplex.com. You cannot access private or protected methods or properties. So use the #if DEBUG to make these …

DatePicker TwoWay-Binding CultureInfo

The sdk:DatePicker seems to have an issue when the value entered need to be bound back to the data container. When showing a value, the current culture info is used. When binding back, always en-US is used. Accordingly, entering the 31st of December fails to bind back, and the 3rd …

Silverlight Resolve Static Resource

Having trouble once again to resolve a static resource in Silverlight code, even though Styles.xaml is located inside the Assets directory? Have a look at app.xaml if Application.Resources contains the following entry: <ResourceDictionary>  <ResourceDictionary.MergedDictionaries>    <ResourceDictionary Source=”Assets/Styles.xaml”/>   </ResourceDictionary.MergedDictionaries></ResourceDictionary>

XML Data Row Truncation At 2,033 Chars When Using SqlDataReader

When you read Extensible Markup Language (XML) data from Microsoft SQL Server by using the SqlDataReader object, the XML in the first column of the first row is truncated at 2,033 characters. You expect all of the contents of the XML data to be contained in a single row and …

Calculate WeekOfYear from DateTime

using System;using System.Globalization ;namespace ConsoleApplication1{    class Class1    {        [STAThread]        static void Main(string[] args)        {            DateTime dt = DateTime.Now;            System.Globalization.Calendar objCal = CultureInfo.CurrentCulture.Calendar;                int weekofyear = objCal.GetWeekOfYear(dt, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);                        Console.WriteLine(weekofyear.ToString() ) ;        }    }}