Skip to content

Commit

Permalink
Fixed OptimizationProfileManagerV5
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Koval authored and Dmitry Koval committed Jul 18, 2024
1 parent f9566e8 commit ab8a2b6
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public OptimizationProfilesResponse GetOptimizationProfiles(out ResultResponse r
{
var response = GetJsonObjectFromAPI<OptimizationProfilesResponse>(new GenericParameters(),
R4MEInfrastructureSettingsV5.OptimizationProfilesList,
HttpMethodType.Get, false, true,
HttpMethodType.Post, false, true,
out resultResponse);

return response;
Expand All @@ -32,7 +32,7 @@ public OptimizationProfilesResponse GetOptimizationProfiles(out ResultResponse r
/// Get Optimization profiles
/// </summary>
/// <returns>List of optimization profiles</returns>
public async Task<Tuple<OptimizationProfilesResponse, ResultResponse>> GetPodWorkflowsAsync()
public async Task<Tuple<OptimizationProfilesResponse, ResultResponse>> GetOptimizationProfilesAsync()
{
var result = await GetJsonObjectFromAPIAsync<OptimizationProfilesResponse>(new GenericParameters(),
R4MEInfrastructureSettingsV5.OptimizationProfilesList,
Expand Down
134 changes: 134 additions & 0 deletions route4me-csharp-sdk/Route4MeSDKUnitTest/Tests/OptimizationTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
using NUnit.Framework;
using Route4MeSDK;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Route4MeSDK.DataTypes;
using Route4MeSDK.QueryTypes;
using Route4MeSDKUnitTest.Types;

namespace Route4MeSDKUnitTest.Tests
{
[TestFixture]
internal class OptimizationTests
{
private static readonly string c_ApiKey = ApiKeys.ActualApiKey;

[Test]
public void RunOptimizationWithoutAlgorithmTypeBeingSetTest()
{
var route4Me = new Route4MeManager(c_ApiKey);

var addresses = new List<Address>()
{
#region Addresses

new Address()
{
AddressString = "754 5th Ave New York, NY 10019",
Alias = "Bergdorf Goodman",
IsDepot = true,
Latitude = 40.7636197,
Longitude = -73.9744388,
Time = 0
},

new Address()
{
AddressString = "717 5th Ave New York, NY 10022",
Alias = "Giorgio Armani",
Latitude = 40.7669692,
Longitude = -73.9693864,
Time = 0
},

new Address()
{
AddressString = "888 Madison Ave New York, NY 10014",
Alias = "Ralph Lauren Women's and Home",
Latitude = 40.7715154,
Longitude = -73.9669241,
Time = 0
},

new Address()
{
AddressString = "1011 Madison Ave New York, NY 10075",
Alias = "Yigal Azrou'l",
Latitude = 40.7772129,
Longitude = -73.9669,
Time = 0
},

new Address()
{
AddressString = "440 Columbus Ave New York, NY 10024",
Alias = "Frank Stella Clothier",
Latitude = 40.7808364,
Longitude = -73.9732729,
Time = 0
},

new Address()
{
AddressString = "324 Columbus Ave #1 New York, NY 10023",
Alias = "Liana",
Latitude = 40.7803123,
Longitude = -73.9793079,
Time = 0
},

new Address()
{
AddressString = "110 W End Ave New York, NY 10023",
Alias = "Toga Bike Shop",
Latitude = 40.7753077,
Longitude = -73.9861529,
Time = 0
},

new Address()
{
AddressString = "555 W 57th St New York, NY 10019",
Alias = "BMW of Manhattan",
Latitude = 40.7718005,
Longitude = -73.9897716,
Time = 0
},

new Address()
{
AddressString = "57 W 57th St New York, NY 10019",
Alias = "Verizon Wireless",
Latitude = 40.7558695,
Longitude = -73.9862019,
Time = 0
},

#endregion
};

var parameters = new RouteParameters()
{
RouteStartDateLocal = "2024-07-16"
};

var optimizationParameters = new OptimizationParameters()
{
Addresses = addresses.ToArray(),

Parameters = parameters
};

var dataObject = route4Me.RunOptimization(
optimizationParameters,
out var errorString);

Assert.That(dataObject, Is.Not.Null);

route4Me.RemoveOptimization(new[] { dataObject.OptimizationProblemId }, out errorString);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class OptimizationProfileManagerV5Tests
private static readonly string CApiKey = ApiKeys.ActualApiKey;

[Test]
public void GetPodWorkflowsTest()
public void GetGetOptimizationProfilesTest()
{
var route4Me = new OptimizationProfileManagerV5(CApiKey);

Expand Down

0 comments on commit ab8a2b6

Please sign in to comment.