public async Task GetFormDataFragmentAsyncMethodReturnsCorrectTypeTest()
        {
            var mockFormsPersistenceFragmentService = new Mock <IFormsPersistenceFragmentService>();
            var persistenceController = new FormsPersistenceFragmentController(mockFormsPersistenceFragmentService.Object);

            var result = await persistenceController.GetFormDataFragmentAsync(Guid.NewGuid(), string.Empty);

            Assert.AreEqual(typeof(OkNegotiatedContentResult <string>), result.GetType());
        }
Beispiel #2
0
        public async Task RemoveFormDataAsyncMethodReturnsCorrectTypeTest()
        {
            var formDataId   = Guid.NewGuid();
            var fragmentName = string.Empty;
            var mockFormsPersistenceFragmentService = new Mock <IFormsPersistenceFragmentService>();
            var persistenceController = new FormsPersistenceFragmentController(mockFormsPersistenceFragmentService.Object);

            var result = await persistenceController.RemoveFormFragmentDataAsync(formDataId, fragmentName);

            Assert.AreEqual(typeof(OkResult), result.GetType());
        }
        public void GetFragmentFilterReturnsFilter()
        {
            var mockFormsPersistenceFragmentService = new Mock <IFormsPersistenceFragmentService>();
            var persistenceController = new FormsPersistenceFragmentController(mockFormsPersistenceFragmentService.Object);

            persistenceController.Request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/WebApi/?param1=1");
            var result = persistenceController.GetFragmentFilter();

            Assert.AreEqual("param1", result.Key);
            Assert.AreEqual("1", result.Value);
        }
        public async Task GetFormDataFragmentAsyncMethodCallsCorrectServiceMethodTest()
        {
            var formDataId   = Guid.NewGuid();
            var fragmentName = string.Empty;
            var mockFormsPersistenceFragmentService = new Mock <IFormsPersistenceFragmentService>();
            var persistenceController = new FormsPersistenceFragmentController(mockFormsPersistenceFragmentService.Object);

            await persistenceController.GetFormDataFragmentAsync(formDataId, fragmentName);

            mockFormsPersistenceFragmentService.Verify(m => m.GetFormDataFragmentAsync(formDataId, fragmentName, new KeyValuePair <string, string>()), Times.Once());
        }