示例#1
0
        static void Main(string[] args)
        {
            var claims = string.Join(" ", args).Split(';').Select(c => new Claim(c));
            var cloth  = new Cloth();

            foreach (var claim in claims)
            {
                cloth.AddClaim(claim);
            }

            Console.WriteLine($"Claims that are unique: {string.Join(", ", cloth.ClaimsWithoutOverlap())}");
        }
示例#2
0
        public void Case()
        {
            // Arrange
            var cs = new[]
            {
                "#1 @ 1,3: 4x4",
                "#2 @ 3,1: 4x4",
                "#3 @ 5,5: 2x2"
            };
            var claims = cs.Select(c => new Claim(c));
            var cloth  = new Cloth();

            // Act
            foreach (var claim in claims)
            {
                cloth.AddClaim(claim);
            }

            // Assert
            Assert.Equal(4, cloth.NumberOfCellsWithMultipleClaims());
        }