Get The Unit In A Currency?
Jan 16, 2010What code can you use to get the unit in a currency?
For example in 10,340.55 there is:
10 units for a thousand.
3 units for hundreds
4 units of tens.
1 fifty cent
1 five cent.
What code can you use to get the unit in a currency?
For example in 10,340.55 there is:
10 units for a thousand.
3 units for hundreds
4 units of tens.
1 fifty cent
1 five cent.
I have written one application which communicate with one data logger unit (temperature monitoring unit) and download records after some interval. Unit continuously send current temperature which I have to show on screen and after each one hour I have to download log (all records saved inside unit at max 1024) from unit.
Now problem is after downloading log, application get hang or what we called working in background and resume after some time. If I pause debugger in visual studio 2008 it show control at application start (sub main) with message as "application will resume here after completing execution of current function". There is nothing in output window. So how can i trace is there any events got spool or what actually application doing in background.
Does anyone have a nice sample of a unit convertor handling multiple unit types that I can integrate in my application? I have found this one, but it is only handling one type of unit. For example I want to convert weight as well as volume from and to imperial units.
View 8 RepliesI am trying to create a currency converter that will convert currency. I have a text box to enter the amount and 2 combo boxes to choose which currency you are converting from and to.
I am using a webservice site XML that contains the conversions.
The problem is I cannot get the display to work properly.
I tried to make an unit test for this method which is pretty simple only add an object into the data base and if it works well returns true
[Code]...
I have been assigned a task of exploring unit testing using tools available in the market.My question is how do i write an API that would help in writing unit test cases.Example i can use nunit to write something like this to check whether file exists in the given location.
<Test()> _
Public Sub CheckOutputFileInfo()
ReportPath = "D:temp est.txt"
[code].....
So when that code run the program don't switch.Say I want to
Open a file
Write something
Close a file
Way when I open a file, another thread want to open that same file. That means open a file get executed twice.
When i perform unit testing on routines, using the unit testing framwork provided by VSTS, i need to get a output of the unit test and result on to a document (documentation). how do i do i do this?
View 1 RepliesI want to create a logic to calculate the age and unit from entered birth date. eg: If the difference between birth date and current date is >= 24 months, I will want it to display the age in years. If >= 8 weeks, I will want it to display it in months and so on here's my code
[Code].....
How do I go about rounding up to the nearest (Unit 10) ie Codes Below
IfVal(TimeHalfFareTextBox.Text = $/£ 0.05)
Then roundup
to $/£ 0.10. Or it might be .....
[Code]....
In the project that i;m currently working on i;m not allowed to touch GUI for anyreason that includes program testing. I'm in bit of s frustration becuase prior to this all must application were developed and tested using GUI. Typicvally it wold take a me a week to develop an app now it taking more than that. Especially the TDD with Unit testing. The documentation kills more time too......
View 4 RepliesI really like the moq mocking framework. I've used it on several projects. Unfortunately, one of my customers is demanding we use VB.Net. Not my preference, but hey, .Net is .Net, right?I've heard that moq has some trouble with VB. Is this true? Is so, what sorts of trouble? I would expect it to work fine given the language agnostic nature of .Net.
Should I look into using some other mocking framework for use with VB?
I have a unit test project and a project A that refers to the dll B. When make changes to the dll B and build my solution again I get an error meassage: could not load dll B or one of it's dependencies when i try to run the test project. The dll B does not exists in the references of the test project.
View 11 RepliesI want to know is their a way to display the imaginary unit i. For example when I calculate the square root of -25, I want the program to display the answer 5i instead of NaN (Not a Number). So is their a way to display imaginary numbers and even complex numbers in visual basic 2008.
View 8 RepliesI created some string resources in My.Resources. I want to use those resources in my unit tests.How do I expose these resources to my unit test project?I tried simply setting the Access Modifier to "Public" for the resources. This made it so that I can compile the code, but it is ignoring the culture setting.
Bo.My.Resources.Culture = New CultureInfo("en-GB", False)
LocaleTest(Bo.My.Resources.Yes, "Yea")
I am writing a test unit (in MSTest) that consumes an XML file located in the testing project. I have this (solution name is BusinessLogic, project name is BusinessLogicTest):
Public TestContext As TestContext
<TestMethod()>
<DeploymentItem("BusinessLogic.BusinessLogicTestTestData.xml")>
<DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",
"|DataDirectory|TestData.xml", "Row", DataAccessMethod.Sequential)> _
Public Sub ConvertIntToRoman_DataDrivenTest
[Code] .....
However, when I run the test I get an error: The unit test adapter failed to connect to the data source or to read the data. I belive it's something to do with my DeploymentItem and/or DataSource, however, I cannot find an example (in VB) that works anywhere.
Doing some homework on unit testing and in all honestly i just don't get why i get this error.
i got a simple method that select all text when tab and testing if the actually textbox1 is selected. I just don't get why i'm getting a nullReferenceException at target.txtbox1_Enter(sender, e)
Private Sub txtbox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtbox1.enter
Dim txtBox As TextBox
[Code].....
I've read about creating factories, and unit testing driven development and how it actually saves you time during the debug phase of development. I'm using some libraries for an entity framework (Entity Spaces, since we are not on dot-net 4.0 yet)
Since getting started seems to be the hardest part for me to wrap my brain around, How would I create a factory for an object that is unit testable on a simple method like so?
[Code]...
However when I call video, its giving me "possible null reference exceptions" errors, and indeed its throwing a null reference. If my constructor is declared public and shared, and is creating a new object, then returning it, why is it giving me null exceptions?
I'm wanting to create a load of unit tests to make sure my stored procedures are working, but i'm failing (i'm new to tests in visual studio).Basically I want to do the following:
<testclass()>
Dim myglobalvariable as integer
<testmethod()>
[code]....
The problem is because the tests don't run sequentially, tests 2 and 3 fail because the global variable isn't set.
Can anyone point me towards a complete scenario using MSTest,vb.net, with or without mocks,MVP (supervising controller)
View 1 RepliesI receive a decimal number with a maximum of 4 digits after the "." and I know this number is in milligram.
I have to find the best matching unit (milligram, gram, kilogram) for the number.
for an example if I receive
edited
116000000.0000 milligram, it's going to return 116.0000 kilogram
66990000.0000 milligram, it's going to return 66.9900 kilogram
49000010.0000 milligram, it's going to return 49000.0100 g
[Code]....
how to convert a metric unit to standard. I will be converting Feet/Inches to Meters/Centimeters and vise versa as well as pounds/ounces to kilograms/grams and vise versa. I can input the values into my Textbox to where it reads " x'y" ," however, when I go to code the Convert button (the same button has to be used for all conversions) how to separate out the text and then perform the conversion.
View 7 RepliesIs there currently any possible way to report progress of my unit test? I have a test that could take up to a hour, and I don't want to sit there not knowing what % it is done with. I have tried writing with debug.print and trace.writeline, neither of which seem to work.
View 1 RepliesI want to include an optional parameter in a function statement that is of the type Unit. For example:
Public Shared Function NewTable(Optional ByVal TableWidth As Unit) As Table
Optional parameters require a default value, but I cannot figure out how to set a default value for a Unit type.
I would like to prevent all subsequent unit tests from running when certain conditions are met in a unit test. Is this possible in Visual Studio 2005?
View 2 RepliesI am having a problem with a unit test I have created. First time doing this so I am not sure why I am getting this error [code]Test method ETDS_Unit_Tests.LoginTest.ValidateUserNameTest threw exception: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server).This is the same connection that my software is using, and the software runs fine, only the unit test is failing. What I am doing wrong? It Seems to fail one time for each datarow in the table.Also, I am using a Linq Query in the method that I being tested. I believe that this may be what is causing my error.
View 2 RepliesI have a constructor that looks like this:
Public Sub New()
MyBase.New()
ws.Url = My.Settings.WebServiceURL
End Sub
(ws is private)
Is there any point in unit testing this?
The class did not previously have this constructor.
Usually when you add one (in Visual Basic), it pops up a message asking if you want to enable an option that lets the test access things like private methods etc.
However, I am editing a solution that does not have this enabled. I'd like to enable it so my unit tests will work, but I can't find the setting.
Can anyone tell me how to enable it after the project has been created?
I am trying to unit test a controller action that uses the membership provider to update user details. I am using Moq which so far has been easy to use. The problem is I can't seem to get it to mock calls to methods that don't return anything.
[Code].....
I have a lump of code that looks a bit like this:
If mode = DiaryMode.Admin Then
modeObject = DBNull.Value
ElseIf mode = DiaryMode.Academy Then
modeObject = ApplicationSettings.Academy
ElseIf mode = DiaryMode.Scouting Then
modeObject = ApplicationSettings.Scouting
Else
Throw New NotSupportedException()
End If
The idea of the check is to prep some values for passing into a database call. There are two questions, is the Else worth the effort? The intention is to prevent future extensions of the enum causing the code to return squify results. If the code is valid, I'd like to be able to unit test the behaviour, if it's worth having it's worth testing. How might I go about doing that?