using Microsoft.VisualStudio.TestTools.UnitTesting; using SLH.SSDMS.Common; using SLH.SSDMS.Model.DO; using SLH.SSDMS.Services; using SLH.SSDMS.Services.serviceImpl; using System; using System.Collections.Generic; using System.Linq.Expressions; namespace SLH.SSDMS.Test { [TestClass] public class UnitTest1 { private static IBaseServices baseServices = new BaseServices(); private static string last; [TestMethod] public void TestMethod1() { var code = Console.ReadLine(); test(code); } public string test(string code) { List list = new List(); list.Add("abc"); list.Add("123"); list.Add("456"); list.Add("789"); if (StringExtension.IsNotBlank(last)) { int presentIndex = list.IndexOf(code); int lastIndex = list.IndexOf(last); if (lastIndex > 0 && presentIndex > 0 && lastIndex < presentIndex) { return "0"; } if (lastIndex > 0 && presentIndex > 0 && lastIndex > presentIndex) { return "1"; } if (presentIndex == 0 && lastIndex > presentIndex) { return "0"; } if (presentIndex == 0 && presentIndex > lastIndex) { return "1"; } } return ""; } } }