Reputation: 676
I am starting to play around with F# so I thought I would start by using it for unit testing. The problem is that Visual Studio keeps telling me that the type is not defined for some of the types I am using and I can't understand why.
I have imported the namespace and the type that I am using is public. Here is the F# code:
namespace OpcPersistenceTest
open System
open NUnit.Framework
open OpcPersistence
open OpcPersistence.Data
[<TestFixture>]
type PushServicesTesting() =
[<Test>]
let ``create a subscription, then shutdown service, start service, should retrieve original subscription`` =
let filters = new ResizeArray<Filter>()
[new Filter(Operand = "EventType", Operator = "=", Value = "SimpleAlarm");
new Filter(Operand = "Area", Operator = "=", Value = "Area_A")]
|> Seq.iter filters.Add
let keys = new ResizeArray<string>()
[Guid.NewGuid().ToString(); Guid.NewGuid().ToString();] |> Seq.iter keys.Add
let configId = PushServices.CreateSubscription(filters, keys)
PushServices.Shutdown()
PushServices.Startup()
let subscription = PushServices.GetSubscriptions(configId)
And some of the C# code:
using System;
using System.Text.RegularExpressions;
namespace OpcPersistence.Data
{
public struct Filter
{
public string Operand { get; set; }
public string Operator { get; set; }
public object Value { get; set; }
...
The type Filter is apparently undefined (so is the type PushServices) but if I swap it out for another class in the same namespace, I do not have this problem. I have even tried changing the name of the class but to no avail. Any ideas?
Edit:
It also doesn't show up in intellisense as the rest of the namespace does as depicted in the picture below.
Upvotes: 1
Views: 2320
Reputation: 25516
Since this apparently solved the problem (from the comments)
When you are using multiple projects, the intellisense and error messages may not be correct, particularly if you change a file in another project without building.
Rebuilding the solution can make the problem go away.
Upvotes: 4