Exemplo n.º 1
0
        public void GetIssue()
        {
            // Mock local storage
            var mockLocalStorage = new MockLocalStorage();

            mockLocalStorage.GetIssuesImpl = (() =>
            {
                return(new List <Issue>()
                {
                    MockLocalStorage.mockIssue1,
                    MockLocalStorage.mockIssue2,
                    MockLocalStorage.mockIssue3
                });
            });

            var uc = TestHelper.GetTestcontainer();

            uc.RegisterInstance <IStorage>(mockLocalStorage);

            var tsc    = new TSController();
            var retval = tsc.GetIssues();

            Assert.IsTrue(retval.Count == 3);
            Assert.IsTrue(retval[0].Id == MockLocalStorage.mockIssue1.Id);
            Assert.IsTrue(retval[1].Id == MockLocalStorage.mockIssue2.Id);
            Assert.IsTrue(retval[2].Id == MockLocalStorage.mockIssue3.Id);
        }
Exemplo n.º 2
0
        public void SearchIssues2()
        {
            // Mock local storage
            var mockLocalStorage = new MockLocalStorage();

            mockLocalStorage.SearchIssuesImpl = ((title, pri, stat, assignedTo) =>
            {
                return(new List <Issue>()
                {
                    MockLocalStorage.mockIssue1,
                    MockLocalStorage.mockIssue2
                });
            });

            var uc = TestHelper.GetTestcontainer();

            uc.RegisterInstance <IStorage>(mockLocalStorage);

            var tsc    = new TSController();
            var retval = tsc.SearchIssue(priority: Priority.High);

            Assert.IsTrue(retval.Count == 2);
            Assert.IsTrue(retval[0].Id == MockLocalStorage.mockIssue1.Id);
            Assert.IsTrue(retval[1].Id == MockLocalStorage.mockIssue2.Id);
        }
        protected override void OnArrange()
        {
            TestConfig          = Test <Configuration> .Item;
            TestConfig.Mappings = new List <BoardMapping> {
                TestConfig.Mappings[0]
            };
            MockConfigurationProvider.Setup(x => x.GetConfiguration()).Returns(TestConfig);
            MockLeanKitClientFactory.Setup(x => x.Create(It.IsAny <LeanKitAccountAuth>())).Returns(LeanKitApi);
            var testSettings = Test <AppSettings> .Item;

            MockLocalStorage.Setup(x => x.Load()).Returns(testSettings);
            TestItem = new TestTarget(SubscriptionManager, ConfigurationProvider, LocalStorage,
                                      LeanKitClientFactory);
            TestCard = Test <CloneableCard> .Item;
            TestConfig.Mappings[0].Identity.LeanKit = BoardId;
        }
Exemplo n.º 4
0
        public void SearchIssueById()
        {
            // Mock local storage
            var mockLocalStorage = new MockLocalStorage();

            mockLocalStorage.SearchIssueByIdImpl = ((x) =>
            {
                return(MockLocalStorage.mockIssue1);
            });

            var uc = TestHelper.GetTestcontainer();

            uc.RegisterInstance <IStorage>(mockLocalStorage);

            var tsc    = new TSController();
            var retval = tsc.SearchIssueById(MockLocalStorage.mockIssue1.Id);

            Assert.IsTrue(retval.Id == MockLocalStorage.mockIssue1.Id);
        }
Exemplo n.º 5
0
        public void DeleteIssue()
        {
            // Mock local storage
            var mockLocalStorage = new MockLocalStorage();

            mockLocalStorage.DeleteIssueImpl = ((x) =>
            {
                return(true);
            });

            var uc = TestHelper.GetTestcontainer();

            uc.RegisterInstance <IStorage>(mockLocalStorage);

            var tsc    = new TSController();
            var retval = tsc.DeleteIssue(MockLocalStorage.mockIssue3.Id);

            Assert.IsTrue(retval.GetType().Name == "OkResult");
        }
 public void It_should_not_attempt_to_load_app_settings()
 {
     MockLocalStorage.Verify(x => x.Load(), Times.Never());
 }
 protected override void OnArrange()
 {
     base.OnArrange();
     MockLocalStorage.Setup(x => x.Load()).Returns(TestSettings);
 }