Added solution files

This commit is contained in:
2021-10-06 15:52:01 +13:00
parent 715e37429e
commit 9fa9b2a87d
11 changed files with 797 additions and 0 deletions
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B9DBC686-8430-4F83-9E27-012844B6CBBB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CloudflareDNSTests</RootNamespace>
<AssemblyName>CloudflareDNSTests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cloudfare DNS Updater\Cloudfare DNS Updater.csproj">
<Project>{3d48b0d8-39a9-4c68-841d-8d8764f2501e}</Project>
<Name>Cloudfare DNS Updater</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets')" />
</Project>
@@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CloudflareDNSTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CloudflareDNSTests")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("b9dbc686-8430-4f83-9e27-012844b6cbbb")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+72
View File
@@ -0,0 +1,72 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Cloudfare_DNS_Updater;
using System.IO;
using System.Collections.Generic;
using System.Threading;
namespace CloudflareDNSTests
{
[TestClass]
public class UnitTest1
{
[TestInitialize]
public void TestInitilisation()
{
Program.WriteFile(Environment.CurrentDirectory + "\\Credentials.dat", new string[] { Authority.auth_domain_tag + " = " + "test", Authority.auth_email_tag + " = " + "tester@test.com", Authority.auth_key_tag + " = " + "1234", Authority.auth_zone_tag + " = " + "te", Authority.auth_dns_tag + " = " + "tester" });
Program.WriteFile(Environment.CurrentDirectory + "\\CredentialsMultiple.dat",
new string[] { Authority.auth_domain_tag + " = " + "test", Authority.auth_email_tag + " = " + "tester@test.com", Authority.auth_key_tag + " = " + "1234", Authority.auth_zone_tag + " = " + "te", Authority.auth_dns_tag + " = " + "tester",
"-###",
Authority.auth_domain_tag + " = " + "test2", Authority.auth_email_tag + " = " + "tester2@test.com", Authority.auth_key_tag + " = " + "21234", Authority.auth_zone_tag + " = " + "te2", Authority.auth_dns_tag + " = " + "tester2"});
}
[TestCleanup]
public void TestCleanup()
{
int attempts = 0;
while (attempts++ < 10)
{
try
{
File.Delete(Environment.CurrentDirectory + "\\Credentials.dat");
File.Delete(Environment.CurrentDirectory + "\\CredentialsMultiple.dat");
attempts = 10;
}
catch
{
}
Thread.Sleep(500);
}
}
[TestMethod]
public void TestLoadFile()
{
object[] data1 = Program.LoadData(Environment.CurrentDirectory + "\\Credentials.dat");
List<Authority> authorities = (List<Authority>)data1[1];
Assert.AreEqual(authorities[0].DomainTag.EvaluateAll(), "test");
Assert.AreEqual(authorities[0].EmailTag.EvaluateAll(), "tester@test.com");
Assert.AreEqual(authorities[0].KeyTag.EvaluateAll(), "1234");
Assert.AreEqual(authorities[0].ZoneTag.EvaluateAll(), "te");
Assert.AreEqual(authorities[0].DnsTag.EvaluateAll(), "tester");
}
[TestMethod]
public void TestLoadFileDouble()
{
object[] data1 = Program.LoadData(Environment.CurrentDirectory + "\\CredentialsMultiple.dat");
List<Authority> authorities = (List<Authority>)data1[1];
Assert.AreEqual(authorities[0].DomainTag.EvaluateAll(), "test");
Assert.AreEqual(authorities[0].EmailTag.EvaluateAll(), "tester@test.com");
Assert.AreEqual(authorities[0].KeyTag.EvaluateAll(), "1234");
Assert.AreEqual(authorities[0].ZoneTag.EvaluateAll(), "te");
Assert.AreEqual(authorities[0].DnsTag.EvaluateAll(), "tester");
Assert.AreEqual(authorities[1].DomainTag.EvaluateAll(), "test2");
Assert.AreEqual(authorities[1].EmailTag.EvaluateAll(), "tester2@test.com");
Assert.AreEqual(authorities[1].KeyTag.EvaluateAll(), "21234");
Assert.AreEqual(authorities[1].ZoneTag.EvaluateAll(), "te2");
Assert.AreEqual(authorities[1].DnsTag.EvaluateAll(), "tester2");
}
}
}
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="2.1.1" targetFramework="net472" />
<package id="MSTest.TestFramework" version="2.1.1" targetFramework="net472" />
</packages>