Example #1
0
        public async void CreateAddsInbox3()
        {
            await using (var inbox = new InboxService(MakeInMemoryContext()))
            {
                // Arrange
                var item = new Inbox()
                {
                    Value = "Do third"
                };

                // Act
                item = await inbox.Create(item);

                // Assert
                Assert.NotNull(item);
                Assert.Equal(3, item.Id);
                Assert.Equal("Do third", item.Value);
                Assert.True(IsAboutNow(item.CreatedAt));
                Assert.True(IsAboutNow(item.UpdatedAt));
            }
        }
Example #2
0
        public async void CreateIgnoresEverythingExceptValue()
        {
            await using (var inbox = new InboxService(MakeInMemoryContext()))
            {
                // Arrange
                var item = new Inbox()
                {
                    Id        = 1,
                    Value     = "Do third",
                    CreatedAt = DateTime.Today.AddDays(-2),
                    UpdatedAt = DateTime.Today.AddDays(-1)
                };

                // Act
                item = await inbox.Create(item);

                // Assert
                Assert.NotNull(item);
                Assert.Equal(3, item.Id);
                Assert.Equal("Do third", item.Value);
                Assert.True(IsAboutNow(item.CreatedAt));
                Assert.True(IsAboutNow(item.UpdatedAt));
            }
        }