コード例 #1
0
    public void DetermineNextFreeComputerCode3_Test()
    {
      string[] list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray().Select(c=>c.ToString()).ToArray();

      var sut = new ComputerModel();

      sut.DetermineNextFreeComputerCode(list).ShouldEqual("AA");
    }
コード例 #2
0
    public void DetermineNextFreeComputerCode_Test()
    {
      var list = new[] {"A", "B"};

      var sut = new ComputerModel();

      sut.DetermineNextFreeComputerCode(list).ShouldEqual("C");
    }
コード例 #3
0
    public void DetermineNextFreeComputerCode5_Test()
    {
      var list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray().Select(c=>c.ToString()).ToList();
      list.Add("AA");
      list.Add("AB"); 
      list.Add("AC");
      list.Add("AE");

      var sut = new ComputerModel();

      sut.DetermineNextFreeComputerCode(list).ShouldEqual("AD");
    }
コード例 #4
0
    public void DetermineNextFreeComputerCode2_Test()
    {
      var list = new List<string> {"B", "C", "F", "G"};

      var sut = new ComputerModel();

      sut.DetermineNextFreeComputerCode(list).ShouldEqual("A"); // fill hole

      list.AddRange(new[] { "A" });
      list.Sort();
      sut.DetermineNextFreeComputerCode(list).ShouldEqual("D"); // fill hole

      list.AddRange(new [] {"D", "E", "H"});
      list.Sort();
      sut.DetermineNextFreeComputerCode(list).ShouldEqual("J"); // skip I

      list.AddRange(new[]{"J","K"});
      sut.DetermineNextFreeComputerCode(list).ShouldEqual("M"); // skip L
    
      list.AddRange(new[]{"M","N"});
      sut.DetermineNextFreeComputerCode(list).ShouldEqual("P"); // skip O
    }
コード例 #5
0
    public void DetermineNextFreeComputerCode6_Test()
    {
      var list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray().Select(c=>c.ToString()).ToList();
      
      for (var ch1 = 'A'; ch1 <= 'C'; ch1++)
      for (var ch2 = 'A'; ch2 <= 'Z'; ch2++)
      {
        list.Add("" + ch1 + ch2);
      }

      var sut = new ComputerModel();

      sut.DetermineNextFreeComputerCode(list).ShouldEqual("DA");
    }