コード例 #1
0
        public void ChooseRotors_ShouldReturn400_WhenPassedRotorsABC()
        {
            // Arrange
            var controller = new EnigmaController();

            controller.Request = new HttpRequestMessage();

            // Act
            HttpResponseMessage message = controller.ChooseRotors("ABC");

            // Assert
            Assert.AreEqual(HttpStatusCode.BadRequest, message.StatusCode);
        }
コード例 #2
0
        public void SetRotor_ShouldReturn200Ok_WhenSettingIncorrectRotor()
        {
            // Arrange
            var controller = new EnigmaController();

            controller.Request = new HttpRequestMessage();

            string jsonRotor = @"
              {
                'RotorNum':4,
                'Setting':'k'
              }";

            HttpResponseMessage message = controller.ChooseRotors("123");

            // Act
            message = controller.SetRotor(JsonConvert.DeserializeObject <RotorDto>(jsonRotor), 2);

            // Assert
            Assert.AreEqual(HttpStatusCode.OK, message.StatusCode);
        }