Esempio n. 1
0
        public async Task ShouldSetTasks()
        {
            //  Arrange

            var storeOptions = new Mock <IOptions <TodoTaskStoreOption> >();

            storeOptions
            .SetupGet(m => m.Value)
            .Returns(new TodoTaskStoreOption
            {
                InitialSet = StoreTests.tasks.ToArray()
            });

            var store = new TodoTaskStore(storeOptions.Object);

            // Act

            await store.Set(existing => existing.Take(1));

            var result = await store.Get();

            // Assert

            Assert.Equal(Enumerable.Empty <TodoTaskEntity>().Append(StoreTests.tasks[0]), result);
        }
Esempio n. 2
0
        public async Task ShouldGetTasks()
        {
            //  Arrange

            var storeOptions = new Mock <IOptions <TodoTaskStoreOption> >();

            storeOptions
            .SetupGet(m => m.Value)
            .Returns(new TodoTaskStoreOption
            {
                InitialSet = StoreTests.tasks.ToArray()
            });

            var store = new TodoTaskStore(storeOptions.Object);

            // Act

            var result = await store.Get();

            // Assert

            Assert.Equal(StoreTests.tasks, result);
        }