Пример #1
0
        public void GetJobsList_ProvidingLimitAndOffset_ShouldGetJobsListAccordingToLimitAndOffset(int limit, int offset)
        {
            //Arrange
            var query       = new Application.Jobs.List.Query(limit, offset, new DateTime(2019, 1, 31, 17, 59, 26, 548));//use a year ago date to get correct query
            var listHandler = new Application.Jobs.List.Handler(testContext, testMapper, testUserAccessor);
            //Act
            var listResult = listHandler.Handle(query, CancellationToken.None).Result;

            //Assert
            Assert.NotNull(listResult);
            Assert.AreEqual(listResult.JobsCount, 2);
            Assert.That(listResult.Jobs[0].JobName, Is.EqualTo("TestJob1"));
            Assert.That(listResult.Jobs[0].Company, Is.EqualTo("Netapp"));
            Assert.That(listResult.Jobs[0].Replication, Is.EqualTo("Zerto"));
            Assert.That(listResult.Jobs[0].Servers, Is.EqualTo("7"));
            Assert.That(listResult.Jobs[0].RTA, Is.EqualTo("10"));
            Assert.That(listResult.Jobs[0].Results, Is.EqualTo("OK"));
            Assert.That(listResult.Jobs[0].Key, Is.EqualTo("AAAA-BBBB-CCCC-DDDD"));
            Assert.That(listResult.Jobs[0].RTONeeded, Is.EqualTo("20"));
            Assert.That(listResult.Jobs[1].JobName, Is.EqualTo("TestJob2"));
            Assert.That(listResult.Jobs[1].Company, Is.EqualTo("EMC"));
            Assert.That(listResult.Jobs[1].Replication, Is.EqualTo("Veeam"));
            Assert.That(listResult.Jobs[1].Servers, Is.EqualTo("30"));
            Assert.That(listResult.Jobs[1].RTA, Is.EqualTo("20"));
            Assert.That(listResult.Jobs[1].Results, Is.EqualTo("OK"));
            Assert.That(listResult.Jobs[1].Key, Is.EqualTo("AAAA-BBBB-CCCC-DDDD"));
            Assert.That(listResult.Jobs[1].RTONeeded, Is.EqualTo("30"));
        }
Пример #2
0
        public void GetJobsList_ProvidingWrongLimitAndOffset_ShouldGetZeroJobs(int limit, int offset)
        {
            //Arrange
            var query       = new Application.Jobs.List.Query(limit, offset, new DateTime(2019, 1, 31, 17, 59, 26, 548));//use a year ago date to get correct query
            var listHandler = new Application.Jobs.List.Handler(testContext, testMapper, testUserAccessor);
            //Act
            var listResult = listHandler.Handle(query, CancellationToken.None).Result;

            //Assert
            Assert.NotNull(listResult);
            Assert.AreEqual(listResult.JobsCount, 0);
        }