Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions Tests/GenericCollections/CollectionTestBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
//using nanoFramework.TestFramework;
//using System;
//using System.Collections;

//namespace GenericCollections
//{
// public class CollectionTestBase
// {
// protected static readonly int[] s_intArray = new[] { -4, 5, -2, 3, 1, 2, -1, -3, 0, 4, -5, 3, 3 };
// protected static readonly int[] s_excludedFromIntArray = new int[] { 100, -34, 42, int.MaxValue, int.MinValue };

// [Flags]
// protected enum IListApi
// {
// None = 0,
// IndexerGet = 0x1,
// IndexerSet = 0x2,
// Count = 0x4,
// IsReadOnly = 0x8,
// Clear = 0x10,
// Contains = 0x20,
// CopyTo = 0x40,
// GetEnumeratorGeneric = 0x80,
// IndexOf = 0x100,
// Insert = 0x200,
// RemoveAt = 0x400,
// GetEnumerator = 0x800,
// End
// }

// protected class CallTrackingIList<T> : IList<T>
// {
// private IListApi _expectedApiCalls;
// private IListApi _calledMembers;

// public CallTrackingIList(IListApi expectedApiCalls)
// {
// _expectedApiCalls = expectedApiCalls;
// }

// public void AssertAllMembersCalled()
// {
// if (_expectedApiCalls != _calledMembers)
// {
// for (IListApi i = (IListApi)1; i < IListApi.End; i = (IListApi)((int)i << 1))
// {
// Assert.Equal(_expectedApiCalls & i, _calledMembers & i);
// }
// }
// }

// public T this[int index]
// {
// get
// {
// _calledMembers |= IListApi.IndexerGet;
// return default(T);
// }
// set
// {
// _calledMembers |= IListApi.IndexerSet;
// }
// }

// public int Count
// {
// get
// {
// _calledMembers |= IListApi.Count;
// return 1;
// }
// }

// public bool IsReadOnly
// {
// get
// {
// _calledMembers |= IListApi.IsReadOnly;
// return false;
// }
// }

// public void Add(T item)
// {
// throw new NotImplementedException();
// }

// public void Clear()
// {
// _calledMembers |= IListApi.Clear;
// }

// public bool Contains(T item)
// {
// _calledMembers |= IListApi.Contains;
// return false;
// }

// public void CopyTo(T[] array, int arrayIndex)
// {
// _calledMembers |= IListApi.CopyTo;
// }

// public IEnumerator<T> GetEnumerator()
// {
// _calledMembers |= IListApi.GetEnumeratorGeneric;
// return null;
// }

// public int IndexOf(T item)
// {
// _calledMembers |= IListApi.IndexOf;
// return -1;
// }

// public void Insert(int index, T item)
// {
// _calledMembers |= IListApi.Insert;
// }

// public bool Remove(T item)
// {
// throw new NotImplementedException();
// }

// public void RemoveAt(int index)
// {
// _calledMembers |= IListApi.RemoveAt;
// }

// IEnumerator IEnumerable.GetEnumerator()
// {
// _calledMembers |= IListApi.GetEnumerator;
// return null;
// }
// }
// }
//}
51 changes: 51 additions & 0 deletions Tests/GenericCollections/GenericCollections.nfproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<NanoFrameworkProjectSystemPath>$(MSBuildExtensionsPath)\nanoFramework\v1.0\</NanoFrameworkProjectSystemPath>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props')" />
<ItemGroup>
<ProjectCapability Include="TestContainer" />
</ItemGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>2b275f71-e555-46bf-b1fe-c33d4cb06545</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<FileAlignment>512</FileAlignment>
<RootNamespace>GenericCollections</RootNamespace>
<AssemblyName>NFUnitTest</AssemblyName>
<IsCodedUITest>False</IsCodedUITest>
<IsTestProject>true</IsTestProject>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode Condition="'$(TF_BUILD)' == 'True' or '$(ContinuousIntegrationBuild)' == 'True'">true</RestoreLockedMode>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
<ItemGroup>
<Compile Include="CollectionTestBase.cs" />
<Compile Include="ListTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\nanoFramework.System.Collections\nanoFramework.System.Collections.nfproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib">
<HintPath>..\..\packages\nanoFramework.CoreLibrary.2.0.0-preview.20\lib\netnano1.0\mscorlib.dll</HintPath>
</Reference>
<Reference Include="nanoFramework.TestFramework">
<HintPath>..\..\packages\nanoFramework.TestFramework.4.0.0-preview.44\lib\nanoFramework.TestFramework.dll</HintPath>
</Reference>
<Reference Include="nanoFramework.UnitTestLauncher">
<HintPath>..\..\packages\nanoFramework.TestFramework.4.0.0-preview.44\lib\nanoFramework.UnitTestLauncher.exe</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
</Project>
Loading
Loading