Skip to content

Instantly share code, notes, and snippets.

View Ganeshcse's full-sized avatar

Ganesh Ganeshcse

  • Bangalore, India
View GitHub Profile
<Style TargetType="{x:Type local:StagedProgressBar}">
<Setter Property="BorderBrush" Value="Black"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="Foreground" Value="Black"></Setter>
<Setter Property="Background" Value="#e6e6e6"></Setter>
<Setter Property="Border.CornerRadius" Value="5"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="Template">
<Setter.Value>
public class BarControl
{
public Brush BarBrush { get; set; }
public double BarHeight { get; set; }
public int BarValue { get; set; }
public double BarWidth { get; set; }
// Object which should be returned as out parameter from another mock object
var mockedObject = MockRepository.GenerateMock<IRealTimeData>();
mockedObject.Expect(x => x.HeatValue).Return(30);
// Mock object which has method GetRealTimeData(out var ...) with out params as IRealTimeData
serverMockObject.Expect(x => x.GetRealTimeData(out _)).OutRef(mockedObject).Return(true);
var actualValue = serice.GetHeatValue();
// Inside the implementation of above method, see below.
interface IMediatorMessage
{
}
interface IMessageHandler<T> where T : IMediatorMessage
{
void Handle(T message);
}
@Ganeshcse
Ganeshcse / MainFile.cs
Last active November 19, 2021 02:20
Async calls
class Session
{
private List<UseCase> useCaseList;
public void ExecuteSession()
{
foreach(var useCase in useCaseList)
{
useCase.ExecuteUseCase();
// Probelm is here. The next use case starts executing before completion of the previous use-case.
// This utility is build using Nunit framework like other NUnit tests.
// My main goal of this utility is,
// if there is any exceptions then I have to fail my unit test.
// for any if conditions, instead of using a if...else, I have to fail my unit test.
// To achieve this, I am using Assert.Fail where ever necessary. Like few sample'e are below.
//if(value == null)
//{
//Assert.Fail("Value cannot be null in this case");