Example #1
0
        public async Task GetNoticesNumReturnsNotNullString()
        {
            //Arrange
            await contextMemory.Employeers.AddAsync(new Manager()
            {
                Id = "abcde", Name = "TestManager2", Email = "*****@*****.**"
            });

            await contextMemory.Notices.AddAsync(new Notice()
            {
                Id = 1, EmployeerId = "abcde-142578", EmployeerName = "TestManager", Text = "TestNotice", IsViewed = false
            });

            await contextMemory.SaveChangesAsync();

            var controller = new AJAXController(contextMemory);

            // Act
            ContentResult result = await controller.GetNoticesNum("*****@*****.**");

            var str = result.Content;

            // Assert
            Assert.NotNull(result);
            Assert.IsType <ContentResult>(result);
            Assert.Equal("0", str);
        }
Example #2
0
        public void IndexReturnsOk()
        {
            //Arrange
            var controller = new AJAXController(contextMemory);

            // Act
            IActionResult result = controller.Index();

            // Assert
            Assert.IsType <ContentResult>(result);
            Assert.NotNull(result);
            Assert.Equal("Ok", (result as ContentResult).Content);
        }
Example #3
0
        public async Task GetClientReturnsNotNullJsonResult()
        {
            //Arrange
            await contextMemory.Clients.AddAsync(new Client()
            {
                Id = 5, Name = "TestClient"
            });

            await contextMemory.SaveChangesAsync();

            var controller = new AJAXController(contextMemory);

            // Act
            JsonResult result = await controller.GetClient(5) as JsonResult;

            // Assert
            Assert.IsType <JsonResult>(result);
            Assert.NotNull(result);
        }
Example #4
0
        public async Task GetUserPhotoReturnsStringPath()
        {
            //Arrange
            await contextMemory.Managers.AddAsync(new Manager()
            {
                Id = "abcde-14257", Name = "TestManager", Email = "*****@*****.**", Photo = "c://Photo.png"
            });

            await contextMemory.SaveChangesAsync();

            var controller = new AJAXController(contextMemory);

            // Act
            IActionResult result = await controller.GetUserPhoto("*****@*****.**");

            var str = (result as ContentResult).Content;

            // Assert
            Assert.IsType <ContentResult>(result);
            Assert.Equal("c://Photo.png", str);
            Assert.NotNull(result);
        }