コード例 #1
0
 private void DetermineIfUniqueItem()
 {
     if (gameObject.GetComponent <UniqueItemGenerator>() != null)
     {
         isUniqueItem        = true;
         uniqueItemGenerator = gameObject.GetComponent <UniqueItemGenerator>();
     }
 }
コード例 #2
0
        public void Generates_correct_sequence_test()
        {
            var items = new[] { "Test - 1", "Test - 2", "Test - 3" };

            Assert.Equal("Test", UniqueItemGenerator.GetNextUniqueItem(items, "Test"));

            items = new[] { "Test", "Test - 1", "Test - 4", "Test - 5" };
            Assert.Equal("Test - 2", UniqueItemGenerator.GetNextUniqueItem(items, "Test"));
        }
コード例 #3
0
 public void Ctor_parameter_validations_test()
 {
     Assert.Throws <ArgumentNullException>(() => UniqueItemGenerator.GetNextUniqueItem(null, "Test"));
     Assert.Throws <ArgumentNullException>(() =>
                                           UniqueItemGenerator.GetNextUniqueItem(Enumerable.Empty <string>(), null));
     Assert.Throws <ArgumentNullException>(() =>
                                           UniqueItemGenerator.GetNextUniqueItem(Enumerable.Empty <string>(), "Test", null,
                                                                                 StringComparison.OrdinalIgnoreCase));
 }
コード例 #4
0
        public void Special_collection_size_test()
        {
            Assert.Equal("Test", UniqueItemGenerator.GetNextUniqueItem(Enumerable.Empty <string>(), "Test"));

            var items = new[] { "One", "Two", "Three" };

            Assert.Equal("Test", UniqueItemGenerator.GetNextUniqueItem(items, "Test"));

            items = new[] { "One", "Two", "Test123", "Three" };
            Assert.Equal("Test", UniqueItemGenerator.GetNextUniqueItem(items, "Test"));
        }