Example #1
0
        public void KingShan_Has_Secured_3_Allies_And_IstheRuler_SecretMessageUpperCase()
        {
            //Arrange
            var process = new AlliesProcess();

            var requests = new AllianceRequest[] { new AllianceRequest()
                                                   {
                                                       Country = "AIR", SecretMessage = "oaaawaala".ToUpper()
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "LAND", SecretMessage = "a1d22n333a4444p".ToUpper()
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "ICE", SecretMessage = "zmzmzmzaztzozh".ToUpper()
                                                   } };

            //Act
            var result = process.EvaluateAlliance(requests, "space");

            //Assert
            Assert.AreEqual <string>(result.RulerName, "King Shan");
            Assert.AreEqual <int>(result.Allies.Count(), 3);
        }
Example #2
0
        public void KingShan_CouldNotSecureAllies()
        {
            //Arrange
            var process = new AlliesProcess();

            var requests = new AllianceRequest[] { new AllianceRequest()
                                                   {
                                                       Country = "AIR", SecretMessage = "osqsls".ToUpper()
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "LAND", SecretMessage = "a1d22n333a4444p".ToUpper()
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "ICE", SecretMessage = "zmzmzmzaztzozh".ToUpper()
                                                   } };

            //Act
            var result = process.EvaluateAlliance(requests, "space");

            //Assert
            Assert.AreEqual <string>(result.RulerName, "None");
            Assert.AreEqual <int>(result.Allies.Count(), 0);
        }
Example #3
0
        public void KingShanHas_SentDifferentMessage_ToSameCountry()
        {
            //Arrange
            var process = new AlliesProcess();

            var requests = new AllianceRequest[] { new AllianceRequest()
                                                   {
                                                       Country = "Air", SecretMessage = "oaaawaala"
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "Land", SecretMessage = "a1d22n333a4444p"
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "Ice", SecretMessage = "zmzmzmzaztzozh"
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "Air", SecretMessage = "oaaawaala"
                                                   } };

            //Act
            var result = process.EvaluateAlliance(requests, "space");

            //Assert
            Assert.AreEqual <string>(result.RulerName, "King Shan");
            Assert.AreEqual <int>(result.Allies.Count(), 3);
        }
Example #4
0
        public void Method_Invoked_With_InvalidCountry()
        {
            //Arrange
            var process = new AlliesProcess();

            var requests = new AllianceRequest[] { new AllianceRequest()
                                                   {
                                                       Country = "INVALID_COUNTRY", SecretMessage = "oaaawaala".ToUpper()
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "LAND", SecretMessage = "a1d22n333a4444p".ToUpper()
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "ICE", SecretMessage = "zmzmzmzaztzozh".ToUpper()
                                                   } };

            //Act
            var result = process.EvaluateAlliance(requests, "space");
        }
Example #5
0
        public void KingShan_Sends_Same_Message_MultipleTimes()
        {
            //Arrange
            var process  = new AlliesProcess();
            var requests = new AllianceRequest[] { new AllianceRequest()
                                                   {
                                                       Country = "Air", SecretMessage = "oaaawaala"
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "Air", SecretMessage = "oaaawaala"
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "Air", SecretMessage = "oaaawaala"
                                                   } };

            //Act
            var result = process.EvaluateAlliance(requests, "space");

            //Assert
            Assert.AreEqual <string>(result.RulerName, "None");
        }
Example #6
0
        public void KingShan_Has_Secured_3_Allies_And_IstheRuler_CheckUIFriendlyAllies()
        {
            //Arrange
            var process  = new AlliesProcess();
            var requests = new AllianceRequest[] { new AllianceRequest()
                                                   {
                                                       Country = "AIR", SecretMessage = "oaaawaala".ToUpper()
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "LAND", SecretMessage = "a1d22n333a4444p".ToUpper()
                                                   },
                                                   new AllianceRequest()
                                                   {
                                                       Country = "ICE", SecretMessage = "zmzmzmzaztzozh".ToUpper()
                                                   } };

            //Act
            var result = process.EvaluateAlliance(requests, "space");

            //Assert
            Assert.AreEqual <string>(result.UIFriendlyListOfAllies, "Air, Land, Ice");
        }
Example #7
0
 public Task UpdateAsync(AllianceRequest alliance)
 {
     throw new NotImplementedException();
 }
Example #8
0
        public async Task CreateAsync(AllianceRequest newAllianceRequest)
        {
            await _context.AllianceRequests.AddAsync(newAllianceRequest);

            await _context.SaveChangesAsync();
        }