meine Sys/Db admin & Developper Notitzen - wer Rechtschreibfehler findet darf sie behalten ... my Sys/Db Admin and developper notes - I don't care about typos
Tuesday, February 14, 2017
vstest.console.exe SettingsFile Example for Test Parameters
<RunSettings>
<!-- Parameters used by tests at runtime -->
<TestRunParameters>
<Parameter name="webAppUrl" value="http://localhost" />
<Parameter name="webAppUserName" value="Admin" />
<Parameter name="webAppPassword" value="Password" />
</TestRunParameters>
</RunSettings>
Testclassfile.cs:
[TestClass]
public class NoDbTests
{
private static string _param1="";
[ClassInitialize]
public static void TestClassinitialize(TestContext context)
{
_param1 = context.Properties["webAppUrl"]?.ToString();
Trace.Write("_param1=" +_param1);
//other settings etc..then use your test settings parameters here...
}
/// <summary>tests parameter from runsettings.xml file
/// vstest.console.exe .\isiQiri.Server.Tests.dll /Tests:RunSettingsTest /Settings:runsettings.xml
/// </summary>
[TestMethod]
public void RunSettingsTest()
{
Trace.Write("_param1=" + _param1);
Assert.AreEqual(_param1, "http://localhost");
}
}
Test with:
vstest.console.exe .\isiQiri.Server.Tests.dll /Tests:RunSettingsTest /Settings:runsettings.xml
Thursday, February 09, 2017
sssr custom code functions for timestamp, finding max in a row
Public Function Ms2Str(ms As Int64) As String
Dim ts As TimeSpan = TimeSpan.FromMilliseconds(ms)
Dim s As String = String.Format("{0} {1:00}:{2:00}:{3:00}",ts.Days,ts.Hours,ts.Minutes,ts.Seconds)
Return s
End Function
Public Function Sec2Str(sec As Double) As String
Dim ts As TimeSpan = TimeSpan.FromSeconds(sec)
Dim s As String = String.Format("{0} {1:00}:{2:00}:{3:00}",ts.Days,ts.Hours,ts.Minutes,ts.Seconds)
Return s
End Function
public Function MaxColor(ri as ReportItems, rowNr as integer, colNr as integer, defaultColor as string)
'1. get value of this cell
Dim cellName as String
cellName="c"+rowNr.ToString() +colNr.ToString()
Dim maxVal=ri(cellName).Value
'2. check if any other cell has bigger value
For i As Integer = 0 To 9
cellName="c"+rowNr.ToString() +i.ToString()
Dim compare=ri(cellname).Value
If compare>maxVal Then Return defaultColor 'self not bigger then self
Next
'3. No one was bigger => is biggest or equal
return "LimeGreen"
end Function
Dim ts As TimeSpan = TimeSpan.FromMilliseconds(ms)
Dim s As String = String.Format("{0} {1:00}:{2:00}:{3:00}",ts.Days,ts.Hours,ts.Minutes,ts.Seconds)
Return s
End Function
Public Function Sec2Str(sec As Double) As String
Dim ts As TimeSpan = TimeSpan.FromSeconds(sec)
Dim s As String = String.Format("{0} {1:00}:{2:00}:{3:00}",ts.Days,ts.Hours,ts.Minutes,ts.Seconds)
Return s
End Function
public Function MaxColor(ri as ReportItems, rowNr as integer, colNr as integer, defaultColor as string)
'1. get value of this cell
Dim cellName as String
cellName="c"+rowNr.ToString() +colNr.ToString()
Dim maxVal=ri(cellName).Value
'2. check if any other cell has bigger value
For i As Integer = 0 To 9
cellName="c"+rowNr.ToString() +i.ToString()
Dim compare=ri(cellname).Value
If compare>maxVal Then Return defaultColor 'self not bigger then self
Next
'3. No one was bigger => is biggest or equal
return "LimeGreen"
end Function
.net Formating Timespans
Date Format strings don't work on timespans => have to to it myself
Dim ts As TimeSpan = New TimeSpan(0,3,5)
Dim s As String = String.Format("{0} {1:00}:{2:00}:{3:00}", ts.Days, ts.Hours, ts.Minutes, ts.Seconds)
Dim ts As TimeSpan = New TimeSpan(0,3,5)
Dim s As String = String.Format("{0} {1:00}:{2:00}:{3:00}", ts.Days, ts.Hours, ts.Minutes, ts.Seconds)
Wednesday, February 08, 2017
ssrs custom code
Report Properties Code:
public Function Test() as integer
return 3
end Function
in a Textbox:
=Code.Test()
public Function Test() as integer
return 3
end Function
in a Textbox:
=Code.Test()
Subscribe to:
Posts (Atom)